Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
16 lines (15 sloc) 427 Bytes
param(
$server = "localhost"
)
$failure = 1
try {
$sess = new-pssession -cn $server -Authentication Negotiate
$hostname = Invoke-Command -Session $sess -ScriptBlock {[system.environment]::MachineName }
Write-Host ("Got result computername {0}" -f $hostname)
#if we got so far that would be nice
Remove-PSSession $sess
$failure = 0
} catch {
write-host ("Failure {0} " -f $error[0])
}
exit $failure