diff --git a/xCAT-server/share/xcat/netboot/windows/xCAT.psm1 b/xCAT-server/share/xcat/netboot/windows/xCAT.psm1 index bd3194b6f..93de8736c 100644 --- a/xCAT-server/share/xcat/netboot/windows/xCAT.psm1 +++ b/xCAT-server/share/xcat/netboot/windows/xCAT.psm1 @@ -58,4 +58,22 @@ Function Connect-xCAT { $script:xcatstream = $script:xcatconnection.GetStream() $script:securexCATStream = New-Object System.Net.Security.SSLStream($script:xcatstream,$false,$script:verifycallback) $script:securexCATStream.AuthenticateAsClient($mgtServerAltName) + $script:xcatwriter = New-Object System.IO.StreamWriter($script:securexCATStream) + $script:xcatreader = New-Object System.IO.StreamReader($script:securexCATStream) +} + +Function Get-Power { + Param( + $nodeRange + ) + $data = "`n`trpower`n`tstat`n`t$nodeRange`n`n" + $script:xcatwriter.WriteLine($data) + $script:xcatwriter.Flush() + $response="" + $lastline="" + while (! $lastline.Contains("")) { + $lastline = $script:xcatreader.ReadLine() + $response = $response + $lastline + } + write-host $response }