Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > PowerShell

WMI's IIS Namespace on a remote computer using Powershell

Update your Vista Drivers Update Your Drivers Now!!
Closed Thread
 
Thread Tools Display Modes
Old 05-11-2007   #1 (permalink)
bjd145
Guest


 

WMI's IIS Namespace on a remote computer using Powershell

Has anyone tried to use Powershell to query the microsoftiisv2 namespace
using powershell?

Every time I try I get an 'Access denied'. If I try to query the root/cimv2
namespace I don't have any issues. If I try to query the microoftiisv2
namespace locally, I don't have any issues. I have also tried the
-credential option as well but no luck . . .

The query that I am trying is
Get-WmiObject -namespace "root/microsoftiisv2" -query 'select * fro
m IIsApplicationPoolSetting' <- This works locally

Remotely, I will get the following:
Get-WmiObject -namespace "root/microsoftiisv2" -query 'select * fro
m IIsApplicationPoolSetting' -ComputerName 10.138.75.231

Get-WmiObject : Access denied
At line:1 char:14
+ Get-WmiObject <<<< -namespace "root/microsoftiisv2" -query 'select * from
IIsApplicationPoolSetting' -ComputerName 10.138.75.231

Brian

My System SpecsSystem Spec
Old 05-11-2007   #2 (permalink)
Don Jones [MVP]
Guest


 

Re: WMI's IIS Namespace on a remote computer using Powershell

Have you checked the WMI security on the remote computer? There are
different permission settings for "Enable" (e.g., local use) and "Remote
Enable."

--
Don Jones
Windows PowerShell MVP
Founder: www.ScriptingAnswers.com
Co-Author: "Windows PowerShell: TFM"

"bjd145" <bjd145@discussions.microsoft.com> wrote in message
news:416896B9-E2F8-4738-9C7D-F21DF7129027@microsoft.com...
> Has anyone tried to use Powershell to query the microsoftiisv2 namespace
> using powershell?
>
> Every time I try I get an 'Access denied'. If I try to query the
> root/cimv2
> namespace I don't have any issues. If I try to query the microoftiisv2
> namespace locally, I don't have any issues. I have also tried the
> -credential option as well but no luck . . .
>
> The query that I am trying is
> Get-WmiObject -namespace "root/microsoftiisv2" -query 'select * fro
> m IIsApplicationPoolSetting' <- This works locally
>
> Remotely, I will get the following:
> Get-WmiObject -namespace "root/microsoftiisv2" -query 'select * fro
> m IIsApplicationPoolSetting' -ComputerName 10.138.75.231
>
> Get-WmiObject : Access denied
> At line:1 char:14
> + Get-WmiObject <<<< -namespace "root/microsoftiisv2" -query 'select *
> from
> IIsApplicationPoolSetting' -ComputerName 10.138.75.231
>
> Brian


My System SpecsSystem Spec
Old 05-11-2007   #3 (permalink)
bjd145
Guest


 

Re: WMI's IIS Namespace on a remote computer using Powershell

Yes, the security on the remote computer is fine. I was able to do something
like this aganist the remote computer

get-wmiobject -namespace "root/cimv2" -query 'select * from win32_service'
-Computername 10.138.75.231

I am also able to query the microsoftiisv2 namespace using vbscript.

Brian

"Don Jones [MVP]" wrote:

> Have you checked the WMI security on the remote computer? There are
> different permission settings for "Enable" (e.g., local use) and "Remote
> Enable."
>
> --
> Don Jones
> Windows PowerShell MVP
> Founder: www.ScriptingAnswers.com
> Co-Author: "Windows PowerShell: TFM"
>
> "bjd145" <bjd145@discussions.microsoft.com> wrote in message
> news:416896B9-E2F8-4738-9C7D-F21DF7129027@microsoft.com...
> > Has anyone tried to use Powershell to query the microsoftiisv2 namespace
> > using powershell?
> >
> > Every time I try I get an 'Access denied'. If I try to query the
> > root/cimv2
> > namespace I don't have any issues. If I try to query the microoftiisv2
> > namespace locally, I don't have any issues. I have also tried the
> > -credential option as well but no luck . . .
> >
> > The query that I am trying is
> > Get-WmiObject -namespace "root/microsoftiisv2" -query 'select * fro
> > m IIsApplicationPoolSetting' <- This works locally
> >
> > Remotely, I will get the following:
> > Get-WmiObject -namespace "root/microsoftiisv2" -query 'select * fro
> > m IIsApplicationPoolSetting' -ComputerName 10.138.75.231
> >
> > Get-WmiObject : Access denied
> > At line:1 char:14
> > + Get-WmiObject <<<< -namespace "root/microsoftiisv2" -query 'select *
> > from
> > IIsApplicationPoolSetting' -ComputerName 10.138.75.231
> >
> > Brian

>

My System SpecsSystem Spec
Old 05-11-2007   #4 (permalink)
Don Jones [MVP]
Guest


 

Re: WMI's IIS Namespace on a remote computer using Powershell

Well, the fact that you coudl query root/cimv2 doesn't apply to the
root/microsoftiisv2 namespace security; the fact that what you want to do
works with VBScript, however, does. I'm not sure - let me dig up a VM with
IIS running and mess with it a bit.

--
Don Jones
Windows PowerShell MVP
Founder: www.ScriptingAnswers.com
Co-Author: "Windows PowerShell: TFM"

"bjd145" <bjd145@discussions.microsoft.com> wrote in message
news:E2ECA71F-5EAF-40E1-8206-FD7B6663A43A@microsoft.com...
> Yes, the security on the remote computer is fine. I was able to do
> something
> like this aganist the remote computer
>
> get-wmiobject -namespace "root/cimv2" -query 'select * from win32_service'
> -Computername 10.138.75.231
>
> I am also able to query the microsoftiisv2 namespace using vbscript.
>
> Brian
>
> "Don Jones [MVP]" wrote:
>
>> Have you checked the WMI security on the remote computer? There are
>> different permission settings for "Enable" (e.g., local use) and "Remote
>> Enable."
>>
>> --
>> Don Jones
>> Windows PowerShell MVP
>> Founder: www.ScriptingAnswers.com
>> Co-Author: "Windows PowerShell: TFM"
>>
>> "bjd145" <bjd145@discussions.microsoft.com> wrote in message
>> news:416896B9-E2F8-4738-9C7D-F21DF7129027@microsoft.com...
>> > Has anyone tried to use Powershell to query the microsoftiisv2
>> > namespace
>> > using powershell?
>> >
>> > Every time I try I get an 'Access denied'. If I try to query the
>> > root/cimv2
>> > namespace I don't have any issues. If I try to query the microoftiisv2
>> > namespace locally, I don't have any issues. I have also tried the
>> > -credential option as well but no luck . . .
>> >
>> > The query that I am trying is
>> > Get-WmiObject -namespace "root/microsoftiisv2" -query 'select * fro
>> > m IIsApplicationPoolSetting' <- This works locally
>> >
>> > Remotely, I will get the following:
>> > Get-WmiObject -namespace "root/microsoftiisv2" -query 'select * fro
>> > m IIsApplicationPoolSetting' -ComputerName 10.138.75.231
>> >
>> > Get-WmiObject : Access denied
>> > At line:1 char:14
>> > + Get-WmiObject <<<< -namespace "root/microsoftiisv2" -query 'select *
>> > from
>> > IIsApplicationPoolSetting' -ComputerName 10.138.75.231
>> >
>> > Brian

>>


My System SpecsSystem Spec
Old 05-14-2007   #5 (permalink)
Brian Denicola
Guest


 

Re: WMI's IIS Namespace on a remote computer using Powershell

Just a little more information.

>From the same computer, querying the same IIS6 web server


vbscript:
strComputer = "test-system"
Set objWMIService = GetObject("winmgmts:
{authenticationLevel=pktPrivacy}\\" & strComputer & "\root
\microsoftiisv2")
Set colItemswb = objWMIService.ExecQuery( "Select * from
IIsWebServerSetting" )

For Each objItemwb in colItemswb
WScript.Echo objItemwb.Name & " - " & objItemwb.ServerComment
Next

Results In:
PS C:\Temp> cscript test.vbs
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.

W3SVC/1 - Default Web Site
W3SVC/4242 - Application Center 2000 Administrative Site

Powershell:
PS C:\Temp> Get-WmiObject IIsWebServerSetting -ComputerName test-
system -namespace "root\microsoftiisv2"
Get-WmiObject : Access denied
At line:1 char:14
+ Get-WmiObject <<<< IIsWebServerSetting -ComputerName test-system -
namespace "root\microsoftiisv2"

On May 11, 6:07 pm, "Don Jones [MVP]" <d...@sapien.com> wrote:
> Well, the fact that you coudl query root/cimv2 doesn't apply to the
> root/microsoftiisv2namespace security; the fact that what you want to do
> works with VBScript, however, does. I'm not sure - let me dig up a VM with
> IIS running and mess with it a bit.
>
> --
> Don Jones
> WindowsPowerShellMVP
> Founder:www.ScriptingAnswers.com
> Co-Author: "WindowsPowerShell: TFM"
>
> "bjd145" <bjd...@discussions.microsoft.com> wrote in message
>
> news:E2ECA71F-5EAF-40E1-8206-FD7B6663A43A@microsoft.com...
>
> > Yes, the security on the remote computer is fine. I was able to do
> > something
> > like this aganist the remote computer

>
> > get-wmiobject -namespace "root/cimv2" -query 'select * from win32_service'
> > -Computername 10.138.75.231

>
> > I am also able to query themicrosoftiisv2namespace using vbscript.

>
> > Brian

>
> > "Don Jones [MVP]" wrote:

>
> >> Have you checked the WMI security on the remote computer? There are
> >> different permission settings for "Enable" (e.g., local use) and "Remote
> >> Enable."

>
> >> --
> >> Don Jones
> >> WindowsPowerShellMVP
> >> Founder:www.ScriptingAnswers.com
> >> Co-Author: "WindowsPowerShell: TFM"

>
> >> "bjd145" <bjd...@discussions.microsoft.com> wrote in message
> >>news:416896B9-E2F8-4738-9C7D-F21DF7129027@microsoft.com...
> >> > Has anyone tried to usePowershellto query themicrosoftiisv2
> >> > namespace
> >> > usingpowershell?

>
> >> > Every time I try I get an 'Access denied'. If I try to query the
> >> > root/cimv2
> >> > namespace I don't have any issues. If I try to query the microoftiisv2
> >> > namespace locally, I don't have any issues. I have also tried the
> >> > -credential option as well but no luck . . .

>
> >> > The query that I am trying is
> >> > Get-WmiObject -namespace "root/microsoftiisv2" -query 'select * fro
> >> > m IIsApplicationPoolSetting' <- This works locally

>
> >> > Remotely, I will get the following:
> >> > Get-WmiObject -namespace "root/microsoftiisv2" -query 'select * fro
> >> > m IIsApplicationPoolSetting' -ComputerName 10.138.75.231

>
> >> > Get-WmiObject : Access denied
> >> > At line:1 char:14
> >> > + Get-WmiObject <<<< -namespace "root/microsoftiisv2" -query 'select *
> >> > from
> >> > IIsApplicationPoolSetting' -ComputerName 10.138.75.231

>
> >> > Brian



My System SpecsSystem Spec
Old 05-15-2007   #6 (permalink)
Brian Denicola
Guest


 

Re: WMI's IIS Namespace on a remote computer using Powershell

I think I've found a pretty good work around. You have to use the
WmiSearcher accelerator. The code in powershell is below:

$q = "Select * from IIsSetting"
$y = [WmiSearcher] $q
$y.Scope.Path = "\\10.1.1.1\root\microsoftiisv2"
$y.Scope.Options.Authentication = 6
$a = $y.Get()
foreach ( $b in $a ) {
$b.LogFileDirectory + " + " $b.Name
}

On May 14, 2:09 pm, Brian Denicola <bjd...@gmail.com> wrote:
> Just a little more information.
>
> >From the same computer, querying the same IIS6 web server

>
> vbscript:
> strComputer = "test-system"
> Set objWMIService = GetObject("winmgmts:
> {authenticationLevel=pktPrivacy}\\" & strComputer & "\root
> \microsoftiisv2")
> Set colItemswb = objWMIService.ExecQuery( "Select * from
> IIsWebServerSetting" )
>
> For Each objItemwb in colItemswb
> WScript.Echo objItemwb.Name & " - " & objItemwb.ServerComment
> Next
>
> Results In:
> PS C:\Temp> cscript test.vbs
> Microsoft (R) Windows Script Host Version 5.6
> Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.
>
> W3SVC/1 - Default Web Site
> W3SVC/4242 - Application Center 2000 Administrative Site
>
> Powershell:
> PS C:\Temp> Get-WmiObject IIsWebServerSetting -ComputerName test-
> system -namespace "root\microsoftiisv2"
> Get-WmiObject :Accessdenied
> At line:1 char:14
> + Get-WmiObject <<<< IIsWebServerSetting -ComputerName test-system -
> namespace "root\microsoftiisv2"
>
> On May 11, 6:07 pm, "Don Jones [MVP]" <d...@sapien.com> wrote:
>
> > Well, the fact that you coudl query root/cimv2 doesn't apply to the
> > root/microsoftiisv2namespace security; the fact that what you want to do
> > works with VBScript, however, does. I'm not sure - let me dig up a VM with
> >IISrunning and mess with it a bit.

>
> > --
> > Don Jones
> > WindowsPowerShellMVP
> > Founder:www.ScriptingAnswers.com
> > Co-Author: "WindowsPowerShell: TFM"

>
> > "bjd145" <bjd...@discussions.microsoft.com> wrote in message

>
> >news:E2ECA71F-5EAF-40E1-8206-FD7B6663A43A@microsoft.com...

>
> > > Yes, the security on the remote computer is fine. I was able to do
> > > something
> > > like this aganist the remote computer

>
> > > get-wmiobject -namespace "root/cimv2" -query 'select * from win32_service'
> > > -Computername 10.138.75.231

>
> > > I am also able to query themicrosoftiisv2namespace using vbscript.

>
> > > Brian

>
> > > "Don Jones [MVP]" wrote:

>
> > >> Have you checked the WMI security on the remote computer? There are
> > >> different permission settings for "Enable" (e.g., local use) and "Remote
> > >> Enable."

>
> > >> --
> > >> Don Jones
> > >> WindowsPowerShellMVP
> > >> Founder:www.ScriptingAnswers.com
> > >> Co-Author: "WindowsPowerShell: TFM"

>
> > >> "bjd145" <bjd...@discussions.microsoft.com> wrote in message
> > >>news:416896B9-E2F8-4738-9C7D-F21DF7129027@microsoft.com...
> > >> > Has anyone tried to usePowershellto query themicrosoftiisv2
> > >> > namespace
> > >> > usingpowershell?

>
> > >> > Every time I try I get an 'Accessdenied'. If I try to query the
> > >> > root/cimv2
> > >> > namespace I don't have any issues. If I try to query the microoftiisv2
> > >> > namespace locally, I don't have any issues. I have also tried the
> > >> > -credential option as well but no luck . . .

>
> > >> > The query that I am trying is
> > >> > Get-WmiObject -namespace "root/microsoftiisv2" -query 'select * fro
> > >> > m IIsApplicationPoolSetting' <- This works locally

>
> > >> > Remotely, I will get the following:
> > >> > Get-WmiObject -namespace "root/microsoftiisv2" -query 'select * fro
> > >> > m IIsApplicationPoolSetting' -ComputerName 10.138.75.231

>
> > >> > Get-WmiObject :Accessdenied
> > >> > At line:1 char:14
> > >> > + Get-WmiObject <<<< -namespace "root/microsoftiisv2" -query 'select *
> > >> > from
> > >> > IIsApplicationPoolSetting' -ComputerName 10.138.75.231

>
> > >> > Brian



My System SpecsSystem Spec
Old 05-15-2007   #7 (permalink)
Flowering Weeds
Guest


 

Re: WMI's IIS Namespace on a remote computer using Powershell


"Brian Denicola"

>I think I've found a pretty good work around.


Also since you are working with
IIS config, logs, websites, or any
large file and _all_ here will soon
be using (admins) the Windows
Home Server (comes with IIS 6)
for all your family members and
friends too try Log Parser 2.2.!

PS> LogParser -h -i:ads | select -first 10

Input format: ADS (Active Directory)
Returns properties of Active Directory objects

FROM syntax:

[[<provider>:]//[<username>:<password>@]<server>]/<path> [ ; ...]
Active Directory path(s); default value for <provider> is "IIS",
default
value for <server> is "localhost"

PS> LogParser -h -i:ads | select -last 3
LogParser "SELECT ObjectPath, PropertyValue
FROM IIS://localhost WHERE
PropertyName = 'AccessFlags'"

Yep lots can be done with Log Parser!




My System SpecsSystem Spec
Old 07-04-2007   #8 (permalink)
Erich Stehr
Guest


 

Re: WMI's IIS Namespace on a remote computer using Powershell

In order to remote access the root\MicrosoftIISv2 namespace, you have to
authenticate as an administrator at the packet privacy level (you can/will
get the passwords for the anonymous identities of the sites from the
settings instances, so the whole conversation needs to be encrypted).

Anyone know how to convince gwmi to go to {authenticationLevel=pktPrivacy}?
Or some way of using a WMI moniker (as in the VBScript below) to generate
the object/connection?

Erich


"Brian Denicola" <bjd145@gmail.com> wrote in message
news:1179169775.355884.320260@w5g2000hsg.googlegroups.com...
> Just a little more information.
>
>>From the same computer, querying the same IIS6 web server

>
> vbscript:
> strComputer = "test-system"
> Set objWMIService = GetObject("winmgmts:
> {authenticationLevel=pktPrivacy}\\" & strComputer & "\root
> \microsoftiisv2")
> Set colItemswb = objWMIService.ExecQuery( "Select * from
> IIsWebServerSetting" )
>
> For Each objItemwb in colItemswb
> WScript.Echo objItemwb.Name & " - " & objItemwb.ServerComment
> Next
>
> Results In:
> PS C:\Temp> cscript test.vbs
> Microsoft (R) Windows Script Host Version 5.6
> Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.
>
> W3SVC/1 - Default Web Site
> W3SVC/4242 - Application Center 2000 Administrative Site
>
> Powershell:
> PS C:\Temp> Get-WmiObject IIsWebServerSetting -ComputerName test-
> system -namespace "root\microsoftiisv2"
> Get-WmiObject : Access denied
> At line:1 char:14
> + Get-WmiObject <<<< IIsWebServerSetting -ComputerName test-system -
> namespace "root\microsoftiisv2"
>
> On May 11, 6:07 pm, "Don Jones [MVP]" <d...@sapien.com> wrote:
>> Well, the fact that you coudl query root/cimv2 doesn't apply to the
>> root/microsoftiisv2namespace security; the fact that what you want to do
>> works with VBScript, however, does. I'm not sure - let me dig up a VM
>> with
>> IIS running and mess with it a bit.
>>
>> --
>> Don Jones
>> WindowsPowerShellMVP
>> Founder:www.ScriptingAnswers.com
>> Co-Author: "WindowsPowerShell: TFM"
>>
>> "bjd145" <bjd...@discussions.microsoft.com> wrote in message
>>
>> news:E2ECA71F-5EAF-40E1-8206-FD7B6663A43A@microsoft.com...
>>
>> > Yes, the security on the remote computer is fine. I was able to do
>> > something
>> > like this aganist the remote computer

>>
>> > get-wmiobject -namespace "root/cimv2" -query 'select * from
>> > win32_service'
>> > -Computername 10.138.75.231

>>
>> > I am also able to query themicrosoftiisv2namespace using vbscript.

>>
>> > Brian

>>
>> > "Don Jones [MVP]" wrote:

>>
>> >> Have you checked the WMI security on the remote computer? There are
>> >> different permission settings for "Enable" (e.g., local use) and
>> >> "Remote
>> >> Enable."

>>
>> >> --
>> >> Don Jones
>> >> WindowsPowerShellMVP
>> >> Founder:www.ScriptingAnswers.com
>> >> Co-Author: "WindowsPowerShell: TFM"

>>
>> >> "bjd145" <bjd...@discussions.microsoft.com> wrote in message
>> >>news:416896B9-E2F8-4738-9C7D-F21DF7129027@microsoft.com...
>> >> > Has anyone tried to usePowershellto query themicrosoftiisv2
>> >> > namespace
>> >> > usingpowershell?

>>
>> >> > Every time I try I get an 'Access denied'. If I try to query the
>> >> > root/cimv2
>> >> > namespace I don't have any issues. If I try to query the
>> >> > microoftiisv2
>> >> > namespace locally, I don't have any issues. I have also tried the
>> >> > -credential option as well but no luck . . .

>>
>> >> > The query that I am trying is
>> >> > Get-WmiObject -namespace "root/microsoftiisv2" -query 'select * fro
>> >> > m IIsApplicationPoolSetting' <- This works locally

>>
>> >> > Remotely, I will get the following:
>> >> > Get-WmiObject -namespace "root/microsoftiisv2" -query 'select * fro
>> >> > m IIsApplicationPoolSetting' -ComputerName 10.138.75.231

>>
>> >> > Get-WmiObject : Access denied
>> >> > At line:1 char:14
>> >> > + Get-WmiObject <<<< -namespace "root/microsoftiisv2" -query
>> >> > 'select *
>> >> > from
>> >> > IIsApplicationPoolSetting' -ComputerName 10.138.75.231

>>
>> >> > Brian

>
>



My System SpecsSystem Spec
Closed Thread

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
Vista: This Computer can't connect to the Remote Computer Wes Vista networking & sharing 0 06-20-2007 06:41 PM
How install a msi package on a remote computer with Powershell? msdnuser99 PowerShell 0 01-26-2007 03:53 AM
How can I create share on remote computer with powershell and .NET =?Utf-8?B?RWRkeSBTdGVlbmJlcmdlbg==?= PowerShell 4 09-28-2006 07:03 PM
PowerShell namespace design? Alex K. Angelopoulos [MVP] PowerShell 4 09-01-2006 12:35 PM
Setting a WMI Namespace security descriptor with WMI/PowerShell =?Utf-8?B?Q2hyaXMgQm9sZXk=?= PowerShell 2 07-19-2006 10:19 AM


Update your Vista Drivers Update Your Drivers Now!!

Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008