Forums on Intune, SCCM, and Windows 11

Welcome to the forums. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your topics and posts, as well as connect with other members through your own private inbox!

PENDING SCCM Powershell script variables.

  • Thread starter Thread starter Rsecrist
  • Start date Start date
  • Replies Replies 1
  • Views Views 2K

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
 
I think this is what you are looking for.
 
Back
Top