After Goggling, I discover that I forgot to install IIS 7.0 PowerShell Snap-in as the OS is Windows Server 2008. On the other hand, it is no need to install the snap-in if your OS is Windows Server 2008 R2.
Showing posts with label PowerShell. Show all posts
Showing posts with label PowerShell. Show all posts
Monday, January 2, 2012
PowerShell: Add-PSSnapin WebAdministration in Windows Server 2008
An error occurred when I execute Add-PSSnapin WebAdministration.
After Goggling, I discover that I forgot to install IIS 7.0 PowerShell Snap-in as the OS is Windows Server 2008. On the other hand, it is no need to install the snap-in if your OS is Windows Server 2008 R2.
After Goggling, I discover that I forgot to install IIS 7.0 PowerShell Snap-in as the OS is Windows Server 2008. On the other hand, it is no need to install the snap-in if your OS is Windows Server 2008 R2.
Tuesday, October 18, 2011
PowerShell: Script to Create a Website
//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
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)