1

It seems I can not find clearly written somewhere that when using WMI accelerator in a PowerShell script, you can not pass on authentication.

A little background ...

I am writing PowerShell scripts for SCCM 2012 and found, for instance, the following quite using :

PS R:\> ([wmi]((gwmi -namespace root\sms\site_AAA -class SMS_Application -filter  
"LocalizedDisplayName LIKE '%Winzip_Tartempion%'")
.__PATH)).SDMPackageXML

When executed locally (on the SCCM primary server, it works fine and swiftly. However, the following ends up in error when executed from my desktop computer running W7 :

PS R:\> ([wmi]((gwmi -namespace root\sms\site_AAA -credential $cred 
-ComputerName CEMTECH 
-class SMS_Application -filter "LocalizedDisplayName LIKE   
'%Winzip_Tartempion%'")
.__PATH)).SDMPackageXML

For the time being, using a PSSession is out of the question. With the current infrastructure I have to deal with, using SCCM commandlet is out of the question.

My only question here is : can you confirm that we can not pass any authentication with a WMI accelerator ? At that point, I am searching for that answer mainly for my curiosity. I found a way to manage with my current constraints. It is just that I find the accelerators so "elegant".

Now why do I need it ? I need to access "lazy properties" without using SCCM cmdlets, from a desktop computer to which the user is logged on with an account which will not be the same as the name authorized to connect/access the SCCM primary server.

What I still did not find is how to use "*.__PATH" with the Get-WMIObject cmdlet.

1 Answer 1

2

The WMI-accelerator [wmi] doesn't support alternate credentials.

Why do you need it? You could just run:

$obj = Get-WmiObject -namespace root\sms\site_P41 -credential $cred -ComputerName qs07352 -class SMS_Application -filter "LocalizedDisplayName LIKE '%Winzip_Tartempion%'"
$obj.Get()

$obj.SDMPackageXML
4
  • Thank you for the crystal-clear answer, I'll stop searching that way (accelerator and authentication). Commented Mar 24, 2014 at 13:48
  • However, SDMPackageXML being a lazy property, your suggestion does not work. Commented Mar 24, 2014 at 13:55
  • see updated answer. I don't have SCCM 2012 available atm. so I can't test it.
    – Frode F.
    Commented Mar 24, 2014 at 14:30
  • 1
    Huge ... Beautiful ... Perfect ... It works and I tested that successfully with another lazy properties (RefreshSchedule from SMS_Collection). Thanks a lot, Commented Mar 25, 2014 at 8:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.