header
header Register : : Login header
header
divider
menuleft
menuright
submenu
left

[August 25th, 2008] Check the home page regarding PowerShell related news from a brand new sponsor: Idera

IIS Script
Last Post 18 Nov 2008 09:40 PM by hmartinez930. 11 Replies.
Printer Friendly
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
hmartinez930User is Offline
New Member
New Member
Posts:8
Avatar

--
17 Nov 2008 04:48 PM  

Hi All,

Hope this is the right place to post this. I'm new to Powershell and scripting. I have an install I need to script and it has several steps. I'm trying to get started on chaning properties within IIS. I've been doing some research that points me to the WMI IISWebservice. When I try -getwmiobject IISwebservice I get :Invalid class. So I'm not sure where I'm going wrong here. What I have to do is change certain properites of IIS. For example I'll need to change the Default Website properties, Directory Security and add IP addresses.

This is just one of the steps if I can start here I'm sure I can figure the rest out.

 

Thanks in advanced

EBGreenUser is Offline
New Member
New Member
Posts:61
Avatar

--
17 Nov 2008 04:54 PM  
I'm not an IIS guy. I would suggest getting one of the many WMI viewing tools. WMI Explorer (http://www.primalscript.com/Free_Tools/index.asp) is a good one. Then poke around in WMI to figure out the proper namespace/class.
hmartinez930User is Offline
New Member
New Member
Posts:8
Avatar

--
17 Nov 2008 04:55 PM  
Hi Eb,
Thanks. I downloaded the explorer but no go. I'm not that familiar with it but I didn't find anything searching anything.
EBGreenUser is Offline
New Member
New Member
Posts:61
Avatar

--
17 Nov 2008 06:26 PM  
Are you running the WMI Explorer on the machine that has IIS installed? If not, then you will need to do so (or use one of the other tools that will let you connect to a remote machine).
hmartinez930User is Offline
New Member
New Member
Posts:8
Avatar

--
17 Nov 2008 06:34 PM  

Yes. I have the installer on a VM that is running IIS and hosts two websites. I open the WMI CIM studio and do a search for IIS but I don't get any hits.

EBGreenUser is Offline
New Member
New Member
Posts:61
Avatar

--
17 Nov 2008 06:49 PM  
That is really odd. As I say I'm not really an IIS person, but we do have it running on a dev server. When I use the WMI Explorer on that box I see the MicrosoftIISv2 namespace just fine.
hmartinez930User is Offline
New Member
New Member
Posts:8
Avatar

--
17 Nov 2008 06:58 PM  
That is strange. What is the path? I did a search for both IIS and microsoft and nothing comes up. I'm using IIS 6.0...
EBGreenUser is Offline
New Member
New Member
Posts:61
Avatar

--
17 Nov 2008 07:09 PM  

We have IIS 6.0 as well. Did you try the tool that I linked too? No searching required with it. The namespace is hanging out right there off root.

\\.\root\MicrosoftIISv2

I don't know what permissions are involved, but this command:

Get-WmiObject -ComputerName SERVER -Namespace root\MicrosoftIISv2 -Class IISComputer

at least got me an access denied message instead of an Invalid Namespace error.

hmartinez930User is Offline
New Member
New Member
Posts:8
Avatar

--
17 Nov 2008 07:18 PM  
I'm using the WMI Tool from microsoft. I tried installing the one you posted over it but it fails on install. I tried the command you posted but I get back "
PS C:\MyScripts> Get-WmiObject -Namespace root\MicrosoftIISv2 -Class IISComputer

Get-WmiObject : Invalid namespace
At line:1 char:14
+ Get-WmiObject <<<< -Namespace root\MicrosoftIISv2 -Class IISComputer
EBGreenUser is Offline
New Member
New Member
Posts:61
Avatar

--
17 Nov 2008 07:24 PM  
That really sounds like IIS isn't installed on that machine. Maybe a real IIS person will wander by. Sorry it wasn't a simple issue. Although I guess if it had have been then you probably would have figured it out on your own. :)
hmartinez930User is Offline
New Member
New Member
Posts:8
Avatar

--
17 Nov 2008 07:38 PM  
That's what everything is pointing to, except that it is. :) Thanks for the help anyway EB. If I run across an answer anywhere else I'll be sure to update here.
hmartinez930User is Offline
New Member
New Member
Posts:8
Avatar

--
18 Nov 2008 09:40 PM  
I'm closer to the answer now. There is a problem when running a powershell command to the WMI of a remote machine. See here :

http://msdn.microsoft.com/en-us/library/aa393851.aspx

Also the IISwebservice is not in root\CIMV2 it is located in root\MicrosoftIIXv2.

so I would run this locally (remote gives access denied) to get information

Get-WmiObject -class IIsWebService -Namespace “root\MicrosoftIISv2″

This works. Now all I have to do is look througg the WMI objects to see where the changes I want to make exist.
You are not authorized to post a reply.

Active Forums 4.1
right
   
footer Sponsored by Quest Software • SAPIEN Technologies • ShellTools, LLC • Microsoft Windows Server 2008 footer
footer