Page 1 of 1 1
Topic Options
#84797 - 2002-01-04 12:32 AM Determine what domain a computer is on.
krabourn Offline
Hey THIS is FUN
*****

Registered: 2000-12-11
Posts: 244
Loc: San Antonio, Texas, USA
I have been trying to use WMIQuery() function to determine what domain a computer is on. I know I can use netdom, but I am trying to find a COM method to determine this.

I believe the reason WMIQuery() does not work is because the computer is on a different domain.

How can I get around this?

_________________________
Kelly

Top
#84798 - 2002-01-04 01:17 AM Re: Determine what domain a computer is on.
Alex.H Offline
Seasoned Scripter

Registered: 2001-04-10
Posts: 406
Loc: France
And the kixtart @Domain and @LDomain macros ? (unless it's to really have a kix external possibility)
_________________________
? getobject(Kixtart.org.Signature)

Top
#84799 - 2002-01-04 01:46 AM Re: Determine what domain a computer is on.
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Alex,krabourn

I think Alex has half the answer. The other half is how to formulate the WMI getobject to provide proper credentials other than simple impersonation. Im assuming that you do not have (by default) admin rights in this other domain ?

-Shawn

Top
#84800 - 2002-01-04 03:31 PM Re: Determine what domain a computer is on.
krabourn Offline
Hey THIS is FUN
*****

Registered: 2000-12-11
Posts: 244
Loc: San Antonio, Texas, USA
I have domain admin rights in the domain I am primarily responsible for. The other domains in our company I have workstation admin rights. I do not necessarily know what domain the computer is on.

Is there a way to impersonate the remote workstation, itself. That way I do not need to know, initially, what domain the computer is on.

_________________________
Kelly

Top
#84801 - 2002-01-04 06:04 PM Re: Determine what domain a computer is on.
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Krabourn,

Do you mean something like -

code:

$SystemSet = GetObject("winmgmts:{impersonationLevel=impersonate}!//@WKSTA")

HTH,

- Kent

_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#84802 - 2002-01-04 06:49 PM Re: Determine what domain a computer is on.
krabourn Offline
Hey THIS is FUN
*****

Registered: 2000-12-11
Posts: 244
Loc: San Antonio, Texas, USA
That is what I thought. Here is my line of code.

$SystemSet = GetObject ('winmgmts:{impersonationLevel=impersonate}!//' + $ComputerName)

The difference is that I am specifying a different computer than mine.

I can not cross domains with this.

_________________________
Kelly

Top
#84803 - 2002-01-04 07:31 PM Re: Determine what domain a computer is on.
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
what changes if you open an ipc channel before , means 'use "\\$Computername\ipc$$"' with or without applying credentials ???

Just a thought ...

_________________________



Top
#84804 - 2002-01-04 07:43 PM Re: Determine what domain a computer is on.
krabourn Offline
Hey THIS is FUN
*****

Registered: 2000-12-11
Posts: 244
Loc: San Antonio, Texas, USA
I have tried connecting to C$ and IPC$ with and without credentials.

I do not think that WMI uses a seperate function for authenticating connection.

_________________________
Kelly

Top
#84805 - 2002-01-04 07:52 PM Re: Determine what domain a computer is on.
krabourn Offline
Hey THIS is FUN
*****

Registered: 2000-12-11
Posts: 244
Loc: San Antonio, Texas, USA
I have been playing with the WMI tester and I can connect as the admin of the workstation or as me on the domain. I have workstation admin rights.

What is the syntax to specify a NT logon domain name and password?

[ 04 January 2002: Message edited by: krabourn ]

_________________________
Kelly

Top
Page 1 of 1 1


Moderator:  Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 837 anonymous users online.
Newest Members
ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder, M_Moore
17887 Registered Users

Generated in 0.063 seconds in which 0.029 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org