PowerShell and system openings (top)

Source: Internet
Author: User
Tags system echo

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.