Get-PC/Private/AssetConversion.ps1
Zachary Gorman 4a01da0e5d Init commit
2024-06-11 11:27:55 -07:00

23 lines
804 B
PowerShell

Function Get-AssetConversion($ComputerName){
$SiteName="100"
$SCCMServer="shscm01.int.samhealth.net"
$SCCMNameSpace="root\sms\site_100"
#Set Asset Tag to $comp
$assetTagSCCM = $ComputerName
$SCCMQuery = "select SMS_R_System.Name from SMS_R_System inner join SMS_G_System_SYSTEM_ENCLOSURE on SMS_G_System_SYSTEM_ENCLOSURE.ResourceId = SMS_R_System.ResourceId Where SMS_G_System_SYSTEM_ENCLOSURE.SMBIOSAssetTag = '$assetTagSCCM'"
#Set $comp to find hostname of PC
$nameHolder = Get-WmiObject -namespace $SCCMNameSpace -DirectRead -computer $SCCMServer -query $SCCMQuery | Select-Object -First 1 -ExpandProperty Name
if($null -ne $nameHolder){
$ComputerName = $nameHolder
return $ComputerName
}
return $null
}