PDA

Click to See Complete Forum and Search --> : Way around domain access.


balama
May 9th, 2009, 05:30 AM
I want to write a script using WMI queries to check the processes running on a remote system on the network. This requires me to have a domain user with administrative rights on the remote system. But what if the network I am on does not have a domain?

I have tried using the remote system's Administrator and other local (non-network) users. I always get an Access denied error. (I tested this with wmimgmt.msc).

Are there any patches that I have missed? Maybe a way around this domain business perhaps.

Thanks.

chris128
May 12th, 2009, 07:08 AM
Accessing machines remotely on a non-domain network is always a pain in the arse in my experience...
Only thing I can suggest is try sticking the machine name infront of the admin username like you would with a domain name. So for example if your remote PC is called PC1 and the local admin account on this PC is called Administrator, try a username of: PC1\Administrator

balama
May 13th, 2009, 03:27 AM
Thanks for the reply. I tried it just as you suggested and it is finally able to connect. But now that I am able to connect... it is telling me that the system I am trying to connect to does not have that class (Win32_PerfRawData_PerfProc_Process). After a lot of browsing the internet, I finally discovered that the this class is not there on a Windows Server 2003. Do you think it is possible to add this class to the system... or is this just a fools hope?

chris128
May 13th, 2009, 03:40 AM
oh so its a server 2003 box you are trying to connect to? If you have servers then I'm puzzled as to why you would not have a domain... it costs nothing to make that server a DC and join your workstations to it. But I guess thats a bit off topic, im sure you have your reasons :)
What exactly are you trying to do then, read a performance counter? If so, does it have to be WMI or could you do this in VB.NET (the reason I ask is because it would be a lot easier in VB.NET)

balama
May 13th, 2009, 04:18 AM
Actually, I have created a software that is already monitoring other systems over a domain network (with systems using XP). But I want to use it on a network without a domain (with systems using server 03). Please don't ask why. Since I have already created the application (with database and all), I just wanted to know if there was a way to add that class to a specific system, as it gives the exception of invalid class. So ... to go back to the old drawing board would be... I hope you know what I'm getting at. Thanks for the patience. Your help really means a lot.

chris128
May 13th, 2009, 04:33 AM
OK fair enough :)
On the MSDN site for that WMI namespace it says this:
Minimum supported server: Windows Server 2003
So are you sure that this class does not exist? I cant understand why it wouldnt if its just the performance counters that it grabs data from as Server 2003 definitley has performance counters..

chris128
May 13th, 2009, 04:58 AM
Well I just put together a little script and ran it against one of our 2003 servers here and it worked fine, here's the script:

strComputer = InputBox("Enter remote server name")
strUser = InputBox("Enter username")
strPassword = InputBox("Enter password")

Set objSWbemLocator = CreateObject("WbemScripting.SWbemLocator")
Set objSWbemServices = objSWbemLocator.ConnectServer(strComputer, _
"root\cimv2", strUser, strPassword, "MS_409", "ntlmdomain:" + strComputer)
Set colSwbemObjectSet = objSWbemServices.ExecQuery("Select * From Win32_PerfRawData_PerfProc_Process")

For Each objPerfcounter in colSWbemObjectSet
Wscript.Echo "Performance Counter Process Name: " & objPerfcounter.Name
Next

As you can see, all it does is list the name of each process in the perf counter namespace.

Note that I am running this against a server on a domain but I'm using local admin credentials to access it and am not entering the domain name anywhere so i assume it will work just as well on your server

That help?

balama
May 13th, 2009, 05:02 AM
I don't know if I mentioned this.... but there is one specific server machine that does not have this class. Sorry to be such a bother. I don't know why this machine doesn't have this class... but I might need to add some performance counter classes to the server somehow (including Win32_PerfRawData_PerfProc_Process).

chris128
May 13th, 2009, 05:08 AM
Oh right I thought you meant that you had found that lots of people say server 2003 doesnt have this class (have you tried the script I posted above anyway?).

I dont know how you would go about installing/adding new classes to the WMI config on that server... I would of thought if performance counters are running on that server then the WMI classes just automatically get exposed. You are certain that the performance counters are actually running on this server arent you?

Also have you tried using Start -> Run -> WBEMTEST to check to see if those WMI classes do exist or not?

balama
May 13th, 2009, 05:29 AM
I tried your script and it works fine for other server machines. Except one. I used the wmiexplorer.exe (I found on msdn earlier). I can use this to connect to other machines on the network using their local Administrators and see their classes as well. Problem is that with this particular machine... I keep getting an invalid class exception (when I use wmiexplorer from a remote machine), and I simply don't see the class when I run wmiexplorer on the machine itself.

Thanks.

chris128
May 13th, 2009, 05:33 AM
Hmm sounds like WMI is a little screwed up in general on that server then... This is the reason I avoid using WMI lol it just seems to randomly not work properly on some machines.
Have you tried using the WMI diagnosis scipt from MS? http://www.microsoft.com/downloads/details.aspx?familyid=d7ba3cd6-18d1-4d05-b11e-4c64192ae97d&displaylang=en
(run it from command prompt with cscript so that you can see what its doing)