Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista - PSJobs & WMI

Reply
 
Old 03-03-2008   #1 (permalink)
Mike D


 
 

PSJobs & WMI

Does anyone know why each of the following commands works:

gwmi win32_computersystem
start-psjob -command "gwmi win32_computersystem"
gwmi win32_computersystem -comp Server1

but if I try:

start-psjob -command "gwmi win32_computersystem -comp Server1"

the job fails and the reason is "Access is denied. (Exception from HRESULT:
0x80070005 (E_ACCESSDENIED))"
??

My System SpecsSystem Spec
Old 03-03-2008   #2 (permalink)
Shay Levi


 
 

Re: PSJobs & WMI



Try to move the -computerName parameter out to the cmdlet context:

start-psjob -command "gwmi win32_computersystem" -comp Server1


-----
Shay Levi
$cript Fanatic
http://scriptolog.blogspot.com
Quote:

> Does anyone know why each of the following commands works:
>
> gwmi win32_computersystem
> start-psjob -command "gwmi win32_computersystem"
> gwmi win32_computersystem -comp Server1
> but if I try:
>
> start-psjob -command "gwmi win32_computersystem -comp Server1"
>
> the job fails and the reason is "Access is denied. (Exception from
> HRESULT:
> 0x80070005 (E_ACCESSDENIED))"
> ??

My System SpecsSystem Spec
Old 03-03-2008   #3 (permalink)
Marco Shaw [MVP]


 
 

Re: PSJobs & WMI

Mike D wrote:
Quote:

> Does anyone know why each of the following commands works:
>
> gwmi win32_computersystem
> start-psjob -command "gwmi win32_computersystem"
> gwmi win32_computersystem -comp Server1
>
> but if I try:
>
> start-psjob -command "gwmi win32_computersystem -comp Server1"
>
> the job fails and the reason is "Access is denied. (Exception from HRESULT:
> 0x80070005 (E_ACCESSDENIED))"
> ??
As Shay mentions, drop the "-comp Server1" from the command you pass to
start-psjob.

This is interesting (to me) why it does *not* work though.

The intent with the new remoting is to avoid remote calls that use
"older" protocols. When you call get-wmiobject, you're using RPC,
which isn't all that firewall friendly, to talk to a remote system.

With start-psjob, you're using a simple HTTP or HTTPS based protocol
between each end.

Your command should retain your current credentials, so if you can run
gwmi to the remote system, I'm not sure why doing this as a psjob fails.

Something for me to look into...

Marco

--
Microsoft MVP - Windows PowerShell
http://www.microsoft.com/mvp

PowerGadgets MVP
http://www.powergadgets.com/mvp

Blog:
http://marcoshaw.blogspot.com
My System SpecsSystem Spec
Old 03-03-2008   #4 (permalink)
Mike D


 
 

Re: PSJobs & WMI



"Marco Shaw [MVP]" wrote:
Quote:

> Mike D wrote:
Quote:

> > Does anyone know why each of the following commands works:
> >
> > gwmi win32_computersystem
> > start-psjob -command "gwmi win32_computersystem"
> > gwmi win32_computersystem -comp Server1
> >
> > but if I try:
> >
> > start-psjob -command "gwmi win32_computersystem -comp Server1"
> >
> > the job fails and the reason is "Access is denied. (Exception from HRESULT:
> > 0x80070005 (E_ACCESSDENIED))"
> > ??
>
> As Shay mentions, drop the "-comp Server1" from the command you pass to
> start-psjob.
>
> This is interesting (to me) why it does *not* work though.
>
> The intent with the new remoting is to avoid remote calls that use
> "older" protocols. When you call get-wmiobject, you're using RPC,
> which isn't all that firewall friendly, to talk to a remote system.
>
> With start-psjob, you're using a simple HTTP or HTTPS based protocol
> between each end.
>
> Your command should retain your current credentials, so if you can run
> gwmi to the remote system, I'm not sure why doing this as a psjob fails.
>
> Something for me to look into...
>
> Marco
>
> --
> Microsoft MVP - Windows PowerShell
> http://www.microsoft.com/mvp
>
> PowerGadgets MVP
> http://www.powergadgets.com/mvp
>
> Blog:
> http://marcoshaw.blogspot.com
>
Thanks for the responses. I would like to use the remote features of psjob
cmdlets at some point, but for the moment I'm stuck with using the remote WMI
connections. None of my remote PC's have powershell or ws-man installed.

I would still like to take advantage of the other psjobs benefits, though.

Mike
My System SpecsSystem Spec
Old 03-03-2008   #5 (permalink)
Marco Shaw [MVP]


 
 

Re: PSJobs & WMI

> Thanks for the responses. I would like to use the remote features of psjob
Quote:

> cmdlets at some point, but for the moment I'm stuck with using the remote WMI
> connections. None of my remote PC's have powershell or ws-man installed.
In that case... Instead of this:

start-psjob -command "gwmi win32_computersystem -comp Server1"

You might also be able to try:
$creds=get-credential
start-psjob -command "gwmi win32_computersystem -comp Server1 -cred $creds"

I'm going to try to fire up a couple of VMs now to try this out.

Marco
My System SpecsSystem Spec
Old 03-03-2008   #6 (permalink)
Mike D


 
 

Re: PSJobs & WMI



"Marco Shaw [MVP]" wrote:
Quote:

> In that case... Instead of this:
>
> start-psjob -command "gwmi win32_computersystem -comp Server1"
>
> You might also be able to try:
> $creds=get-credential
> start-psjob -command "gwmi win32_computersystem -comp Server1 -cred $creds"
>
> I'm going to try to fire up a couple of VMs now to try this out.
>
> Marco
>
Hmmm....
"Cannot process argument transformation on parameter 'Credential'. Remote
host method PromptForCredential is no longer implemented."
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
CTP2: Please do not abandon Windows XP and Server 2003 for remoting/psjobs at final release PowerShell
[CTP2] No PSJobs if remoting isn't installed? PowerShell


Vista Forums 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 Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46