Rexxer

Some tips for me and other

MDT + Script for renaming a PC according to his IP

powershell.exe -noprofile -command “Set-ExecutionPolicy Bypass LocalMachine” -force

$strPrefix=”WS”

# Get IP and make the name
$IP=(Get-WmiObject win32_networkadapterconfiguration | Select-Object -Property @{name=’IPAddress’;Expression={($_.IPAddress[0])}} | Where IPAddress -NE $null).IPAddress
$a,$b,$c,$d = $IP.split(‘.’)
$strComputerName=$strPrefix+$c+”-“+$d

# Rename
$computer=gwmi Win32_computersystem
$computer.rename($strComputerName)

Comments are currently closed.