Page 1 of 1 1
Topic Options
#86164 - 2002-06-17 09:48 AM Getting The OS Of A Remote Machine
Mark Pietersz Offline
Getting the hang of it

Registered: 2001-09-30
Posts: 74
Loc: Melbourne, Australia
Folks,

Kix provides the wonderful macro @PRODUCTTYPE. Is there something similar that I can use to get the OS of a remote machine. I have already tried

$oDomain = getobject("WinNT://$sDomainName")
$oDomain.filter = "computer",""
For each $oComputer in $oDomain
$oComputer.operatingsystem
$oComputer.operatingsystemversion
etc...

however the return values are
Windows NT
4.0
I was wanting to know whether the target machine is a server or workstation

The verbage for the ".role" property suggests that it may be useful however in my environment the return value is nothing.
"Role Gets and sets role of this computer (server, workstation, and so on) "

Furthermore, the curious thing is that the following produces no screen output
$x = "Role=" + $oComputer.role + ""
? $x
The following at least outputs the text "Role=" to the screen
$x = "Role=" ;+ $oComputer.role + ""
? $x

What is it about some of these properties that seems to zap the contents of variables ?
_________________________
Mark Pietersz

Top
#86165 - 2002-06-17 10:10 AM Re: Getting The OS Of A Remote Machine
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
mmm...
is there any specific reason why you don't want to use normal script like:
code:
$pp = ReadValue("\\machines_name_or_IP\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ProductOptions","ProductType")

select
Case $pp="WinNT"
$os="Windows NT/2k Workstation"
Case $pp="LANMANNT"
$os="Windows NT 4.0 Domain Controller"
Case $pp="ServerNT"
$os="Windows NT 4.0 Member Server"
endselect

to get all wintosh tree, need little bit more intelligence, but you probably get my point...
_________________________
!

download KiXnet

Top
#86166 - 2002-06-17 11:31 AM Re: Getting The OS Of A Remote Machine
Mark Pietersz Offline
Getting the hang of it

Registered: 2001-09-30
Posts: 74
Loc: Melbourne, Australia
Lonkero,

The only reason that I didn't do that is that I didn't know about it !! Sensational. Thanks.
There's so much in the registry that is not clear. Why do I have CurrentControlSet, CurrentControlSet001 and CurrentControlSet002 ?
I also need to know what logical/physical drives exist on a machine. Can the registry provide that info ? I've looked under "Diskcontroller" and DeviceMap\Scsi but is there makes little sense to me.
Is there a "Dummies Guide To The MS Registry" book available ?
_________________________
Mark Pietersz

Top
#86167 - 2002-06-17 01:24 PM Re: Getting The OS Of A Remote Machine
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
dummy book for reg...
I think it's called power users or sys admins
or something like that...
but it's for dummies.

currentcontrolset is what it says.
currentcontrolset001 is the one before that.
so when you try to load crashing machine from
last working config, I think it tries to use that.
002 is older.
I'm not sure, I've allways thought that they get updated on every boot.
so currentcontrolset001 changes are moved on the next bootup to 002.

affective things are anyway in the set without numbers [Smile]

about that hardware stuff, I remember more than few scripts been posted in here, so try searching on scripts forum and from http://home.wanadoo.nl/scripting/ you get some tools and bases for scripts on stable base.

cheers,
_________________________
!

download KiXnet

Top
#86168 - 2002-06-17 02:14 PM Re: Getting The OS Of A Remote Machine
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
for drives currently available on remote machine you could use registry or:
code:
break on
$machine= "\\what_ever_you_want_to_check_on"
$ascii = 67 ; "C"
while $ascii < 91 ; "Z"
$drive = $machine+"\"+chr($ascii)+"$"
if exist ( $drive )
?"Drive $drive has "+getdiskspace($drive)+" bytes free"
endif
$ascii=$ascii+1
loop
exit

this works only NT/2000/XP without any tricks.
_________________________
!

download KiXnet

Top
#86169 - 2002-06-17 06:02 PM Re: Getting The OS Of A Remote Machine
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
I love my UDF...

code:
? wmiquery("Caption","Win32_OperatingSystem","$computername")
? wmiquery("CSDVersion","Win32_OperatingSystem","$computername")
? wmiquery("SerialNumber","Win32_OperatingSystem","$computername")
? wmiquery("OSProductSuite","Win32_OperatingSystem","$computername")
? wmiquery("Description","Win32_OperatingSystem","$computername")
? wmiquery("InstallDate","Win32_OperatingSystem","$computername")



[ 17 June 2002, 18:03: Message edited by: Radimus ]
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#86170 - 2002-06-17 06:07 PM Re: Getting The OS Of A Remote Machine
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
didn't even think about that!
chees, if one has complete UDF, it'd be sin not to use it, right?
_________________________
!

download KiXnet

Top
#86171 - 2002-06-17 06:57 PM Re: Getting The OS Of A Remote Machine
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
I am starting to collect the 'essential UDF kit' my scripts are getting smaller, but my UDF lib is getting bigger.

The WMIQuery() was the first one in... along with WshShortCut, XlsInputBox, ServiceRun, ServiceStartup, regwrite, FindPROC(modified killproc), Groupmembers, DelDir (once I neutered it for null input), and Ping. there are a few others, but are my lan-specific

Hopefully, the IE library will get working better...
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#86172 - 2002-06-17 07:02 PM Re: Getting The OS Of A Remote Machine
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Radimus, you got a web site, right ? Why don't you post some of this stuff in downloadable form, like your work-in-progress IE GUI Library, that way, we can always get the latest and greatest, instead of copy-pasting it from the board.
Top
#86173 - 2002-06-17 07:23 PM Re: Getting The OS Of A Remote Machine
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
I though about that...

okey dokey... I'll do it tonight.

I have some there now, but it is my office's logon script. my boss wants me to rename the names and addresses in them anyway, for security.. I can understand that
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#86174 - 2002-06-18 02:03 AM Re: Getting The OS Of A Remote Machine
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
I have uploaded the scripts and UDFs to http://www.wheelerfam.com/kixtart.htm
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#86175 - 2002-06-25 07:46 AM Re: Getting The OS Of A Remote Machine
Mark Pietersz Offline
Getting the hang of it

Registered: 2001-09-30
Posts: 74
Loc: Melbourne, Australia
Guys - thanks for the help to date
Is there any answer to my second question

"Furthermore, the curious thing is that the following produces no screen output
$x = "Role=" + $oComputer.role + ""
? $x
The following at least outputs the text "Role=" to the screen
$x = "Role=" ;+ $oComputer.role + ""
? $x

What is it about some of these properties that seems to zap the contents of variables "

Regards

Mark
_________________________
Mark Pietersz

Top
#86176 - 2002-06-27 12:06 AM Re: Getting The OS Of A Remote Machine
Anonymous
Unregistered


I have been using WMIQuery to retrieve the OS information from remote machines. It only seems to work on some machines. I thought at first that it only worked on Win2k, but it works on some NT4SP6 machines as well. It doesn't work on any of our NT 4 Terminal Servers (SP6).

What are the dependencies for WMIQuery?

Thanks,
Michael.

Top
#86177 - 2002-06-27 12:11 AM Re: Getting The OS Of A Remote Machine
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
wmi should be only one.
this means, the machine where it's run on, should have wmi installed.

if not working, report to:
http://81.17.37.55/board/ultimatebb.php?ubb=get_topic;f=12;t=000117

cheers,
_________________________
!

download KiXnet

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 248 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.062 seconds in which 0.023 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