Hi,
I created a scripted to remove and installed SCCM client for SCCm 2007 which was batch file but now I wont to create a same script but in powershell as it will be faster and more reliable.
I was using this script to get PC from sccm group but this doesn't work in sccm 2012 anymore.
functionGet-PC-From-SCCM
{ #https://gallery.technet.microsoft.com/scriptcenter/Get-Computers-in-SCCM-948e666f
$SMSMemebers=
''
$SiteServer='server'
$SiteCode='code'
$CollectionName='Recent Malware Activity'
#$cred = Get-credential
#Retrieve SCCM collection by name
$Collection=get-wmiobject-ComputerName$siteServer-NameSpace"ROOT\SMS\site_$SiteCode"-ClassSMS_Collection|where{$_.Name-eq"$CollectionName"}
#Retrieve members of collection
$SMSMemebers=Get-WmiObject-ComputerName$SiteServer-Namespace"ROOT\SMS\site_$SiteCode"-Query"SELECT * FROM SMS_FullCollectionMembership WHERE CollectionID='$($Collection.CollectionID)' order by name"|select
Name
return$SMSMemebers.Name;
}
I wont to know if possible to create script which gets PC number from sccm 2012 and run remove sccm query and then reinstall back in again.