This demand is simply appalling, is installed computer with IP, (activation, this topic estimated taboo)
There are also some security configurations.
The following script is done in PowerShell
c:/"Microsoft toolkit 2.4.3.exe" echo ==========================echo hyper-v start script, Need at least PowerShell3.0, that is, windows server 2012 system echo 1, install Hyper-V role echo 2, rename add domain #echo 3 Configure the domain account to join the local Administrator echo ========================== $zone 1 = read-host ("Enter computer name (NetBIOS):") cls$ theend2 = "shutdown /r /t 1 " #下面这句开始装角色Install-windowsfeature hyper-v -includemanagementtools$mysecret= "123.ABCDEFG" $mysecret | convertto-securestring -asplaintext -force | Convertfrom-securestring| Out-file c:\adscript\xxx.txt -encoding utf8$securestring= (Get-content c:\adscript\xxx.txt) . ToString () | convertto-securestring$ptr = [system.runtime.interopservices.marshal]:: Securestringtoglobalallocunicode ($secureString) $serverpass = [system.runtime.interopservices.marshal ]::P Trtostringuni ($ptr) $UserName = "Tech\wdsserver" # Define Administrator account name $password = convertto-securestring $serverpass -AsPlainText –Force$cred = New-object system.management.automation.pscredential ($UserName, $Password) #下面加域 add-computer -NewName $zone 1 -domainname tech.bitauto.com -credential $cred -OUPath "Ou=hyperv computer Group, dc=tech,dc=bitauto,dc=com" -Force #前面可以加变量 $usertech, Configure the account to be added to the local administrator #net localgroup /add administrators tech\ $usertechecho Restart the computer after 5 seconds ... If you have an error earlier, you can force the window to close Start-Sleep –s 5echo $theend 2 | Out-file theend2.cmd -encoding default.\theend2.cmd
Here is the PowerShell and cmd mix, format code, and automatically enter the password, not to mention, see the code basically can see, and I also have comments.
So the problem comes, and a little bit of setting up the IP part of the whole?
This article is from the "Nine uncle-Microsoft Private Cloud" blog, please make sure to keep this source http://jiushu.blog.51cto.com/972756/1649630
PowerShell and system openings (top)