Ajout dela structure MDT dans Infra-LAB
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
#powershell -noprofile -command "Set-ExecutionPolicy bypass LocalMachine"
|
||||
|
||||
# On met l'adresse du client en variable
|
||||
$IP = ((Test-Connection $env:COMPUTERNAME -Count 1).IPV4Address).ipaddresstostring
|
||||
|
||||
# Nslookup sur $IP
|
||||
$nomfqdn = (nslookup $IP | Select-String "$IP" -Context 1,0).Context.precontext.substring(9)
|
||||
|
||||
# Retrait du groupe et du domain
|
||||
$nonpc = $nomfqdn.Substring(0,$nomfqdn.IndexOf("."))
|
||||
|
||||
# Renommage du PC
|
||||
Rename-Computer -NewName "$nonpc"
|
||||
|
||||
#restart-computer
|
||||
Reference in New Issue
Block a user