![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| 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. |
| | |||||||
| | Vista - get-wmiobject -credential threw an exception |
| |
| 01-29-2007 | #1 |
| | get-wmiobject -credential threw an exception Hey yo, More silly newb questions I think... I was getting a bit fed up of doing run-as all the time on some of my scripts, so I started messing around with the get-credential stuff. It doesn't seem to work the way I think it should. Here are the two basic commands I'm using in my little script... $cred = Get-Credential MyDomain\MyAdminAccount Get-wmiobject -class exchange_SMTPQueue -Namespace ROOT\MicrosoftExchangev2 -ComputerName MyServer -credential $cred I get prompted for the appropriate password. When I okay the PW prompt, I immediately get the following error: Get-WmiObject : The type initializer for 'System.Management.MTAHelper' threw an exception. My totally uneducated guess is that Get-WmiObject is smacking itself against my local privaleges (not an admin) before it runs out to the requested server with my credentials. Am I right? What can I do about it? The whole point of my use of the Get-Credential is to side-step my local account restrictions on my workstation. Why would Get-Cred be bumping into them if I'm explicitly using the -credential parameter with an account that has the appropriate rights? BTW... the command works perfectly if I do a run-as to start PoSH and the run-as account has admin rights on both the workstation and the server. --Jonathan "smthng" Kalmes http://smthng.info |
| My System Specs |
| 01-29-2007 | #2 |
| | RE: get-wmiobject -credential threw an exception The help file for get-credential has this variant C:\PS>C:\PS>Get-WmiObject Win32_BIOS -ComputerName Server01 ' -Credential (get-credential Domain01\User01) where the credential is created as the wmiobject is created. I suspect then it won't try your local credentials Have you tried anything like this? -- Richard Siddaway Please note that all scripts are supplied "as is" and with no warranty "Jonathan Kalmes" wrote: > Hey yo, > > More silly newb questions I think... > > I was getting a bit fed up of doing run-as all the time on some of my > scripts, so I started messing around with the get-credential stuff. It > doesn't seem to work the way I think it should. Here are the two basic > commands I'm using in my little script... > > $cred = Get-Credential MyDomain\MyAdminAccount > > Get-wmiobject -class exchange_SMTPQueue -Namespace > ROOT\MicrosoftExchangev2 -ComputerName MyServer -credential $cred > > I get prompted for the appropriate password. When I okay the PW prompt, > I immediately get the following error: > > Get-WmiObject : The type initializer for 'System.Management.MTAHelper' > threw an exception. > > My totally uneducated guess is that Get-WmiObject is smacking itself > against my local privaleges (not an admin) before it runs out to the > requested server with my credentials. Am I right? What can I do about > it? The whole point of my use of the Get-Credential is to side-step my > local account restrictions on my workstation. Why would Get-Cred be > bumping into them if I'm explicitly using the -credential parameter with > an account that has the appropriate rights? > > BTW... the command works perfectly if I do a run-as to start PoSH and > the run-as account has admin rights on both the workstation and the server. > > --Jonathan "smthng" Kalmes > http://smthng.info > |
| My System Specs |
| 02-01-2007 | #3 |
| | Re: get-wmiobject -credential threw an exception RichS wrote: > The help file for get-credential has this variant > > C:\PS>C:\PS>Get-WmiObject Win32_BIOS -ComputerName Server01 ' > -Credential (get-credential Domain01\User01) > > where the credential is created as the wmiobject is created. I suspect then > it won't try your local credentials > > Have you tried anything like this? > Just tried it. Two problems appeared... 1 - It throws the same exception. 2 - I now get prompted within every iteration of the loop, instead of just once at the start. Still open for suggestions. ![]() --Jonathan "smthng" Kalmes http://smthng.info |
| My System Specs |
| 02-01-2007 | #4 |
| | Re: get-wmiobject -credential threw an exception did you try WbemTest ? as I did see in this thread its not only happening with PoSH http://www.thescripts.com/forum/thread407575.html Greetings /\/\o\/\/ "Jonathan Kalmes" <smthng@smthng.info> wrote in message news:OKl6bzgRHHA.3412@TK2MSFTNGP05.phx.gbl... > RichS wrote: >> The help file for get-credential has this variant >> >> C:\PS>C:\PS>Get-WmiObject Win32_BIOS -ComputerName Server01 ' >> -Credential (get-credential Domain01\User01) >> >> where the credential is created as the wmiobject is created. I suspect >> then it won't try your local credentials >> >> Have you tried anything like this? >> > > Just tried it. Two problems appeared... > > 1 - It throws the same exception. > 2 - I now get prompted within every iteration of the loop, instead of just > once at the start. > > Still open for suggestions. ![]() > > --Jonathan "smthng" Kalmes > http://smthng.info |
| My System Specs |
![]() |
| Thread Tools | |
| |
| Similar Threads for: get-wmiobject -credential threw an exception | ||||
| Thread | Forum | |||
| Error "The type initializer for ... threw an exception" | .NET General | |||
| Exception Handling - Get-WmiObject on multiple servers | PowerShell | |||
| Exception stack is corrupt when catching and storing the exception | .NET General | |||
| Get-Wmiobject -Credential not working | PowerShell | |||
| Vista Install Error: Exception Unknown Software Exception | Vista installation & setup | |||