#166623 - 2006-08-31 05:08 PM
Re: WMIQuery() Problem and Remote Registry (Update)
|
private_meta
Getting the hang of it
Registered: 2006-07-27
Posts: 80
Loc: Austria
|
That's ok... but again, i'm wondering why the WMIQuery UDF accesses my Floppy Drive while the piece of code WITHOUT WMIQuery() does not...
I've tried it with this one as well Code:
$colItems = $WMI.ExecQuery("Select FreeSpace from Win32_LogicalDisk WHERE DriveType = 3",,48) For Each $objItem in $colItems ?"Free Space: " + $objItem.Freespace ?"-----------" Next
and i even checked the SQL-Statement generated by the WMIQuery (it generated "Select FreeSpace From Win32_LogicalDisk Where DriveType = '3'" as well) but still there are different outputs.
furthermore i tried to extract the WMIQuery-Part for external Computers like shown below, but it didn't work at all
Code:
$objLocator = CreateObject('WbemScripting.SWbemLocator') If @ERROR or not $objLocator Exit VAL("&"+Right(DecToHex(@ERROR),4)) EndIf $SystemSet = $objLocator.ConnectServer($sComputer, $root, $sUserID, $sUserPW) If @ERROR or not $SystemSet Exit VAL("&"+Right(DecToHex(@ERROR),4)) EndIf $SystemSet.Security_.ImpersonationLevel = 3 $objEnum = $SystemSet.ExecQuery($sQuery) FOR EACH $objInstance in $objEnum $=EXECUTE(CHR(36) + 'sValue = ' + CHR(36) + 'objInstance.' + $sWhat) IF VARTYPE($sValue) & 8192 $tmp = $tmp +'|' + join($sValue,'|') ELSE $tmp = $tmp +'|' + $sValue ENDIF Next ? SPLIT(SUBSTR($tmp,2),'|')
Edit: Do i need more then the Variables $sQuery, $sComputer, $root, $sUserID, $sUserPW there?
Edited by private_meta (2006-08-31 05:10 PM)
_________________________
-=If you absolutly believe you can make up talent with hard work, there is no limit to what you can't achieve.=-
|
|
Top
|
|
|
|
#166625 - 2006-08-31 10:45 PM
Re: WMIQuery() Problem and Remote Registry (Update)
|
private_meta
Getting the hang of it
Registered: 2006-07-27
Posts: 80
Loc: Austria
|
I'm not at work right now so i cannot confirm everything i say, but let me say the following:
The Administrator account is on EVERY win2k system the same except for 2 Machinse that belong to the sysadmin. On Win2k-Systems it works ok, i can connect, i can log in, i get the WMI-Information, but as soon as i want to access a WinXP-Workstation FROM win2k or another winxp workstation it does not work. From win2k it says that the RPC-Server could not be found, and from Winxp it just says "denied", tho it works when i access it locally and the rights should be given correctly (to the administrator account in the WMI)
I cannot say it with absolute certainty, but i'm pretty sure these 2 xp-systems and all the win2k systems i tried it with are in the same workgroup (i'm sure for the 2k-sys and one of the xp-sys)
The XP-Firewall is disabled as well for the testing, so i absolutly don't think it would be connection problems (as i can access 2k-systems from the xp-systems)
About the default namespace: how do i set it for a default namespace?
And NTDOC: any idea about the accessing of the Floppy drive? i don't know why it access it, but it doesn't do that when access the WMI without the script. would be nice.
|
|
Top
|
|
|
|
#166626 - 2006-08-31 11:19 PM
Re: WMIQuery() Problem and Remote Registry (Update)
|
NTDOC
Administrator
   
Registered: 2000-07-28
Posts: 11629
Loc: CA
|
I've done this in the past but no longer really have systems in workgroups and different OS to script it for you.
However, please review the documentation here which should help you to undertand better what or how your scripting may be failing and how to correct it.
Connecting to WMI on a Remote Computer http://msdn.microsoft.com/library/defaul...te_computer.asp
Connecting Between Different Operating Systems http://msdn.microsoft.com/library/defaul...ing_systems.asp
|
|
Top
|
|
|
|
#166630 - 2006-09-06 05:34 PM
Re: WMIQuery() Problem and Remote Registry (Update)
|
private_meta
Getting the hang of it
Registered: 2006-07-27
Posts: 80
Loc: Austria
|
Sorry, i've been busy this week until now.
My OS is native german, but i hopefully doubt that MS ported such a quite important feature...
I'm 100% certain that i've set the rights in the right way
I have tried connecting to XP-boxes from other XP-boxes, i've tried it from other 2000-boxes, neither of them does work. In addition, i still have the problem that i can not run the WMIQuery-Script as a different user. TBH i can not run it even with any user. As soon as i enter User Information when calling WMIQuery it does not work, no matter what computer i try to access (Administrator account, user accounts, no matter what, it does not work, even when i try to access those that work without a user because the user on both workstations is the same)
|
|
Top
|
|
|
|
#166631 - 2006-09-09 05:52 AM
Re: WMIQuery() Problem and Remote Registry (Update)
|
Sealeopard
KiX Master
   
Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
|
|
|
Top
|
|
|
|
Moderator: Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart
|
1 registered
(Allen)
and 675 anonymous users online.
|
|
|