Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $ChassiType = (gwmi Win32_SystemEnclosure).ChassisTypes
- $Nics = Get-WmiObject Win32_NetworkAdapterConfiguration
- foreach ($Nic in $Nics) {
- write-host $Nic
- if ($Nic.macaddress) {
- $MACAddress = $Nic.macaddress
- }
- }
- $tsenv = New-Object -COMObject Microsoft.SMS.TSEnvironment
- $newPCName = $MACAddress -replace ':',''
- $SN = gwmi win32_bios | Select โExpandProperty SerialNumber
- $paddedSN = $SN.padleft((12-$SN.lenght),"0")
- switch ($ChassiType){
- {"3","4","6","7","13" -contains $_} {
- #desktops
- $OSDComputerName = "DSK" + $newPCName
- $tsenv.Value("OSDComputerName") = $OSDComputerName
- }
- default{
- $OSDComputerName = "LAP" + $paddedSN
- $tsenv.Value("OSDComputerName") = $OSDComputerName
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement