First, let's look at the PowerShell code that configures the IP address
$wmi =get-wmiobject-class win32_networkadapterconfiguration-filter ipenabled=true-computername. # Set the IP address and subnet mask $wmi. EnableStatic (' 192.168.0.100 ', ' 255.255.255.0 ') # Sets the Gateway $WMI. SetGateways (' 192.168.56.254 ') # Set the DNS$WMI. SetDNSServerSearchOrder (' 192.168.70.1 ')
Then this piece is to write the data to die in the inside, we can use read-host and variable way input, concrete method can refer to my previous article, example many. This piece of advice is inserted into the front of the opening script, because the next step is to add a field.
Another point is that you can also write cmd to import a reg file for quick configuration of Windows hosts.
As we all know, PowerShell script Ps1 file is not able to quickly double-click with the administrator to run, this How to solve it?
We use CMD to solve, create a cmd file
Echo OFFC:CD MD adscriptcd Adscriptecho open Cloud.it>ftptmpecho Anonymous>>ftptmpecho ad>>ftptmpecho Get 7z.exe>>ftptmpecho get 7z.dll>>ftptmpecho get Hvkj.zip>>ftptmpecho quit>>ftptmpftp-s: Ftptmprem cls7z x hvkj.zip copy *.lnk C:\users\public\desktop/ypowershell set-executionpolicy remotesigned
The above sentence is to download files from a local FTP site, to a local specific location, and then release, the shortcuts are released to the desktop, of course, can also be downloaded and run.
Both the download cmd and the run cmd can be directly double-clicked, so the problem is clear.
→→→ make a shortcut, open with admin, run PowerShell from cmd
Still is the cmd mixed write, the concrete view, with the CMD mixed writes the characteristic is, can quickly close the service and runs the registry. Above
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/6C/92/wKioL1VMcLXQMmHLAAPeDJox_Ko714.jpg "title=" 2015-5-8 16-07-21.jpg "alt=" Wkiol1vmclxqmmhlaapedjox_ko714.jpg "/>
This article is from the "Nine uncle-Microsoft Private Cloud" blog, please make sure to keep this source http://jiushu.blog.51cto.com/972756/1649637
PowerShell and System start (bottom)