Tag Archives: WMI

Create New Device in SCCM Using Powershell

Creating a new device in SCCM using powershell with 2012 R1 requires using WMI as there is no cmdlet to do so, but thankfully this is easier now using the CIM cmdlets. Of course if you have 2012 R2 then use Import-CMComputerInformation (thanks @david_obrien) $SCCMSiteServer = ‘SiteServer.FQDN.com’ $SCCMNamespace = ‘Root\SMS\Site_AAA’ $MACAddress = ’00:11:22:33:44:55′ $DeviceName = ‘PCNAME001’ Invoke-CimMethod -ClassName “SMS_Site” -Namespace $SCCMNamespace -ComputerName $SCCMSiteServer -MethodName ‘ImportMachineEntry’ -Arguments @{ MACAddress = $MACAddress; NetbiosName = $DeviceName } As a bonus, here are some functions to create your devices along with basic validation of mac address NB. The “Stugr” in the function names is simply to avoid any clashes with official cmdlets function Format-StugrMACAddress { Param( [Parameter(Mandatory=$true)][string]$MACAddress ) # strip possible variations of dividers $MACAddress = $MACAddress.Replace(‘ ‘,”).Replace(‘:’,”).Replace(‘-‘,”) # mac address must be 12 characters (with no dividers) and hexadecimal if($MACAddress.Length -eq 12 -and $MACAddress -match “^[A-Fa-f0-9]+$”) { return ($MACAddress -replace “(..(?!$))”,’$1:’) # insert … Continue reading

Posted in Technology | Tagged , , , | Leave a comment