Saturday, January 19, 2013

Fun example showing remote PowerShell stuff


In this example we are using the 2012 'Storage Spaces' module, but that is just one example.

$MySession = New-PSSession -ComputerName "Datameister"
$State = Invoke-Command -Session $MySession {Get-StoragePool "Pool-001"}

If($State.OperationalStatus -eq "OK")
{
     Write-Host "Everything is cool"
}
Remove-PSSession $MySession

Cheers!

No comments:

Post a Comment