Sign in to follow this  
Followers 0
cherdeg

WMI - how to authenticate at remote host?

2 posts in this topic

Hi,

this works:

$s_ComputerName = "localhost"
$o_WMIService = ObjGet("winmgmts:{impersonationLevel=Impersonate}!\\" & $s_ComputerName & "\root\cimv2")
$o_ItemCollection = $o_WMIService.ExecQuery("SELECT * FROM Win32_Processor", "WQL", $wbemFlags)oÝ÷ ÚØb±Ú²}ý·
+«­¢+ØÀÌØíÍ}
½µÁÕÑÉ9µôÅÕ½Ðíɵ½Ñ¡½ÍÐÅÕ½Ðì(ÀÌØí½}]5%MÉÙ¥ô=©Ð ÅÕ½ÐíÝ¥¹µµÑÌéí¥µÁÉͽ¹Ñ¥½¹1Ù°õ%µÁÉͽ¹ÑôÌÌìÀäÈìÀäÈìÅÕ½ÐìµÀìÀÌØíÍ}
½µÁÕÑÉ9µµÀìÅÕ½ÐìÀäÈíɽ½ÐÀäÈí¥µØÈÅÕ½Ðì¤(ÀÌØí½}%ѵ
½±±Ñ¥½¸ôÀÌØí½}]5%MÉÙ¥¹áEÕÉä ÅÕ½ÐíM1
P¨I=4]¥¸ÌÉ}AɽÍͽÈÅÕ½Ðì°ÅÕ½Ðí]E0ÅÕ½Ðì°ÀÌØíݵ±Ì¤

Why? Because the user used for this (the user logged on to my local host) has itself no administrative rights on the remote host; it's like using "wbemtest.exe" against "\\remotehost\root\cimv2" without entering "User" and "Password" at the connection dialogue. I know the correct credentials (local Administrator) for the remote host...but how to make ObjGet() use them?

Please help!

Share this post


Link to post
Share on other sites



Never mind - if it's urgent, it seems still being best just helping yourself:

Global $s_ComputerName = "remotehost"
Global $s_AdminUser = "Administrator"
Global $s_AdminLocPW = "password"
$o_SWbemLocator = ObjCreate("WbemScripting.SWbemLocator")
$o_WMIService = $o_SWbemLocator.ConnectServer($s_ComputerName, "root\CIMV2", $s_AdminUser, $s_AdminLocPW)
$o_ItemCollection = $o_WMIService.ExecQuery("SELECT * FROM Win32_Processor", "WQL", $wbemFlags)

Never the less: Thanks 4 reading!

1 person likes this

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0