23 lines
804 B
PowerShell
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
|
|
}
|