Rsecrist
New Member
- Messages
- 1
- Reaction score
- 0
- Points
- 1
I have been looking for this answer and maybe I am asking the wrong way. I want to run a script over a device collection. I want to do a test-connection prior to executing the remainder of the script. I want to get the name of the device from the SCCM PowerShell environment, and not from a list or text file. When the script is run over a collection, the name of the devices are available because the results show the names in the order they were processed. Here is a simple example.
# Tests all devices in a collection
If (Test-Connection -targetname $computername -quiet)
{ Do script
}
Where can I retrieve the $computername from? [No lists, no text files, from the PowerShell SCCM environment]
Thanks
# Tests all devices in a collection
If (Test-Connection -targetname $computername -quiet)
{ Do script
}
Where can I retrieve the $computername from? [No lists, no text files, from the PowerShell SCCM environment]
Thanks