Stopping selected Windows Services with Powershell

Standard

I set all of the VMWare services on my machine to be manual start recently and figured the easiest way to restart when I needed to spin up a VM was with a simple net start … batch file.

That would be a perfectly good solution but I figured Powershell must provide another way and in one of those “I wonder if…” moments I tried executing the following in an elevated PS window and was pleased to see it work out perfectly.

Stop-Service VM*

Advertisements

IIS 7 Powershell Provider under Windows Server 2008 R2

Standard

I recently wanted to get access to the IIS Powershell cmdlets on a Windows Server 2008 R2 machine. I initially thought I needed to install the Provider that can be downloaded from iis.net. However, I soon realised this wasn’t correct as running the MSI gave me the error “The Powershell Snapin is part of the Windows Operating System…”.

After a quick google it turns out this feature is baked into R2 and installed through the IIS Management Scripts and Tools Service Role which is part of the Web Server Role (I always get confused if I should be looking in Features or Roles every time I go into the Server Manager snap-in).

With these installed there is one more step you need to take to get access to all the IIS goodness and that’s to bring the module into your current Powershell session. This can be achieved with the command import-module WebAdministration.

I hope this helps save others some time when accessing IIS through Powershell on a Windows Server 2008 R2 machine.