//enable run script in PowerShell Set-ExecutionPolicy RemoteSigned //import module Import-Module WebAdministration //create a application pool New-WebAppPool testpool Set-ItemProperty iis:\AppPools\testpool -name processModel -value @{username="administrator";password="password";identitytype=3} Set-ItemProperty iis:\AppPools\testpool -name managedRuntimeVersion -value v4.0 //create a web site New-Item iis:\sites\testSite -physicalpath "C:\Users\WebSite" -bindings @{protocol="http";bindingInformation=":8083:"} -ApplicationPool testPool $website = get-item iis:\sites\testSite $website.virtualDirectoryDefaults.userName="administrator" $website.virtualDirectoryDefaults.password="password" $website | set-item
Tuesday, October 18, 2011
PowerShell: Script to Create a Website
Monday, October 17, 2011
PowerShell: Get-Service -Name "MSSQL$SQLEXPRESS"
You can use "get-service" command to get current status of the service.
But, when I execute the following command in PowerShell:
Get-Service -Name "MSSQL$SQLEXPRESS"
There is an error found below:
Get-Service : Cannot find any service with service name 'MSSQL'.
At line:1 char:12
+ Get-Service <<<< -Name "MSSQL$SQLEXPRESS"
The solution is: using "*" instead of "$"
Subscribe to:
Posts (Atom)