Hi,
I would like testing server name in a script to see in which domaine the computer is:
$tsenv = New-Object -COMObject Microsoft.SMS.TSEnvironment $servers = "server1","server2","server3" Foreach($s in $servers) { if (Test-Connection -Cn $s -BufferSize 16 -Count 1 -ea 0 -quiet){ Echo $s $tsenv.value("SCCMServer")=$s }
Then I get impossible calling a method from a null expression.
$s is existing as server1 so the SCCMServer variable should get server1 as value...
Where am I wrong and how solving it?