- 计算机重命名:
Set-ExecutionPolicy RemoteSigned -Force
$ID = Read-Host("请输入您的工号:")
$New_Name = "BJ-" + $ID
$Old_Name = hostname
Rename-Computer -ComputerName $Old_Name -NewName $New_Name -Force
$ws = New-Object -ComObject WScript.Shell
$ws.Popup("请尽快保存文件,1分钟后计算机会自动重启!!!",'10','温馨提示',0+48)
Start-Sleep -Seconds 55
$ws.Popup("计算机开始重启!!!",'5','温馨提示',0+48)
Restart-Computer -Force
- 数据拷贝
$user = $env:username
$user_path = "C:\Users\$user\Desktop"
Copy-Item -Path "$user_path\*" -Destination C:\desktop -Recurse -Force
Copy-Item -Path "C:\Users\Public\Desktop\*" -Include *.lnk -Destination C:\desktop -Recurse -Force
- 加域
$domain = "immomo.com"
$user = "join.domain"
$pwd = "Pssword" | ConvertTo-SecureString -AsPlainText -Force
$cred = New-Object System.Management.Automation.PSCredential($user,$pwd)
Add-Computer -DomainName $domain -Credential $cred -Restart
标签:domain,Force,Name,ws,自助,New,客户端,加域,user
From: https://blog.51cto.com/magic3/7597888