Results 1 to 11 of 11

Thread: Way around domain access.

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 2008
    Posts
    235

    Way around domain access.

    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.

  2. #2
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    Re: Way around domain access.

    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
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


  3. #3

    Thread Starter
    Addicted Member
    Join Date
    May 2008
    Posts
    235

    Re: Way around domain access.

    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?

  4. #4
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    Re: Way around domain access.

    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)
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


  5. #5

    Thread Starter
    Addicted Member
    Join Date
    May 2008
    Posts
    235

    Re: Way around domain access.

    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.

  6. #6
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    Re: Way around domain access.

    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..
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


  7. #7
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    Re: Way around domain access.

    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:
    Code:
    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?
    Last edited by chris128; May 13th, 2009 at 05:02 AM.
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


  8. #8

    Thread Starter
    Addicted Member
    Join Date
    May 2008
    Posts
    235

    Re: Way around domain access.

    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).

  9. #9
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    Re: Way around domain access.

    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?
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


  10. #10

    Thread Starter
    Addicted Member
    Join Date
    May 2008
    Posts
    235

    Re: Way around domain access.

    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.

  11. #11
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    Re: Way around domain access.

    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/d...displaylang=en
    (run it from command prompt with cscript so that you can see what its doing)
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width