Navigate IIS 7.0 via PowerShell

03/22/2010

PowerShell

Now that you have the Windows PowerShell Snap-in for IIS 7.0 loaded (how-to posted here), let’s navigate IIS to see what we can find.

First, you need to switch over to the IIS namespace in order to display information much like you would in IIS Manager. Type “cd IIS:\“, then type “dir“. You should now see the top level structure of IIS. Now type, “cd AppPools“, then type “dir“. You now see a list of your Application Pool names, the status, and the associated application(s) with each app pool. The screenshot below depicts the actions you just took (I have SP2010 installed on this machine):

Next, we’ll move up a directory and drill into Sites. Type “cd..“, then “cd Sites“, and “dir” – just like you would in DOS. Looking into this we quickly get the name, ID, state, physical path, and a list of bindings for each site on our server – pretty cool, eh?

Lastly, use the Get-Item command in conjunction with Select-Object to display the configuration settings for one of the sites. Type “Get-Item <Site Name> | Select-Object *“. View the below screenshot as an example:

 

You could use this same approach for one of the Application Pools too – just make sure you navigate back to IIS:\AppPools before running the command. The next posts regarding IIS and PowerShell will focus more on task based functions you can do, as well as backing up your configuration settings. So, check back soon!

Advertisements

Subscribe

Subscribe to our RSS feed and social profiles to receive updates.

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: