Last active
February 24, 2016 20:56
-
-
Save bcdady/daaaf988636d3f38dc63 to your computer and use it in GitHub Desktop.
Test-WSMan alternative, with custom PS Object
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$Private:WinRMListener = & winrm e winrm/config/listener; foreach ($line in $Private:WinRMLTokens = $WinRMListener -split '\n') { $Private:lineTokens = $line -split '=';if ($lineTokens[0] -like '*Source*') { $Private:source = $($lineTokens[1]).trim().replace('"','').replace(']','') }; if ($lineTokens[0] -like '*Transport*') { $Private:Transport = $($lineTokens[1]).trim() }; if ($lineTokens[0] -like '*Port*') { $Private:Port = $($lineTokens[1]).trim() }; if ($lineTokens[0] -like '*Enabled*') { $Private:Enabled = $($lineTokens[1]).trim() }; if ($lineTokens[0] -like '*ListeningOn*') { $Private:ListeningOn = $(($lineTokens[1] -split ',')[0]).trim() } }; $Private:properties = [ordered]@{ 'Source' = $source; 'Transport' = $Transport; 'Port' = $Port; 'Enabled' = $Enabled; 'ListeningIP' = $ListeningOn }; $Private:WinRMListenerInfo = New-Object -TypeName PSObject -Property $properties; $WinRMListenerInfo |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$Private:WinRMVersion = & winrm id; $Private:WinRMVerTokens = $WinRMVersion -split '='; $Private:ProductVerTokens = $WinRMVerTokens[6] -split ' ';$Private:properties = [ordered]@{'ProductVersion'=$WinRMVerTokens[6];'OS'=$ProductVerTokens[2];'SP'=$ProductVerTokens[4];'Stack'=$ProductVerTokens[6]};$Private:WinRMID = New-Object -TypeName PSObject -Property $properties;$WinRMID |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment