Question

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.

Was it helpful?

Solution

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
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top