Showing posts with label PowerShell. Show all posts
Showing posts with label PowerShell. Show all posts

Saturday, 30 April 2016

Listing all Exchange SMTP email addresses and aliases

Exports a list of Display names, Primary email address and any aliases and outputs them to a file on the C:\

Get-Mailbox -ResultSize Unlimited |Select-Object DisplayName,PrimarySmtpAddress, @{Name=“EmailAddresses”;Expression={$_.EmailAddresses |Where-Object {$_.PrefixString -ceq “smtp”} | ForEach-Object {$_.SmtpAddress}}} | Export-CSV c:\exported-smtp-addresses.csv -NoTypeInformation

Wednesday, 17 June 2015

Disable Windows firewall from PowerShell

Set-NetFirewallProfile -Profile Domain,Public,Private -Enabled False
Set-NetFirewallProfile -Profile Domain,Public,Private -Enabled True

Thursday, 4 September 2014

Finding Dell firmware versions from PowerShell

Get-WmiObject -Namespace root\CIMV2\Dell -Class Dell_CMApplication -Filter "componentType = 'FRMW'" -ComputerName "localhost" | Select name,version

Tuesday, 10 December 2013

Patching Windows 2012 Hyper-V 3.0

For a reason unknown to me Microsoft has a number of hotfixes that fix some nasty bugs in Hyper-V 3.0 but aren't' downloaded via Windows update.

Christian Edwards wrote a Technet blog was written to scan for the missing patches a while back, but it was a ball-ache obtaining the individual patches.

http://blogs.technet.com/b/cedward/archive/2013/05/24/validating-hyper-v-2012-and-failover-clustering-2012-hotfixes-and-updates-with-powershell.aspx

Some clever dude has written a PowerShell script to scan the cluster for missing patches, and download them using BITS for your convenience.

https://github.com/it-praktyk/Get-WindowsHotfixes

Tuesday, 10 September 2013

Check Hyper-V replica status across the cluster

If you would like to check the replication status of all the VMs across your cluster you can use this PwerShell command.

get-clusternode | ForEach-Object  {Invoke-command -computername $_.name -scriptblock {get-VMReplication}} | ft name, State, Health, PrimaryServer