PowerShell for asp.net developer part 1
Power Shell is the new scripting language promoted by Microsoft. It has tremendous potential and as asp.net developer you can utilize it to complete some daily tasks.
To run PowerShell , you can key windows Key +R , type PowerShell
The PowerShell command will show up
You can add the IIS Snap-in using command Import-Module WebAdministration. However , it might throw exception below.
You need to restart your PowerShell under administrator and run the command SET-EXECUTIONPOLICY remoteSigned and then Import-Module WebAdministration.
(You can check TechNet page for details) You can test the setup by running Get-Website, this command will retrieve all the web sites from IIS.
To create web site under IIS , you can use the command New-Website. You can type Get-Help New-Website to see all the parameters.
Now we create web site called mystie by running command
First , you need to create a folder
New-Item $env:systemdrive\inetpub\MyNewWebSite -type directory
Then create the site this folder directory as the website physical path
New-Website -name “MyNewWebSite” -PhysicalPath “$env:systemdrive\inetpub\MyNewWebSite” -port 8888