Hello Folks,

This week I needed to export from SCCM, the devices name and MAC Address to a CSV file.

I need this file to create green list into DHCP server. The Green list give permission to have a lease from DHCP server. I will speak of this subject in a futur post.

To find informations on devices into SCCM, we can work with WMI Class of SCCM. This script is based on WMI request.

$SiteName = "FR1"
$ServerSite = "sccm"
$Mycoll = @()
foreach ($obj in (Get-WmiObject -Class SMS_R_SYSTEM -Namespace "root\sms\site_$SiteName" -computerName $ServerSite)) {
Write-Host $obj.NetbiosName $obj.MACAddresses $obj.OperatingSystemNameandVersion
$Mydetails = "" | Select-Object PCName, MacAddress, OS
If ($([String]$obj.MACAddresses) -eq "") {
$Mydetails.PCName = $obj.NetbiosName
$Mydetails.MacAddress = "Nul"
$Mydetails.OS = $obj.OperatingSystemNameandVersion
}
Else {
$Mydetails.PCName = $obj.NetbiosName
$Mydetails.MacAddress = [String]$obj.MACAddresses
$Mydetails.OS = $obj.OperatingSystemNameandVersion
}
$Mycoll += $Mydetails
}
$Mycoll | Out-GridView

 

 

0 33