Page 1 of 1 1
Topic Options
#92638 - 2003-08-20 01:44 PM WMI?? Howto Remotely get @ProductType and @SysLang
MightyR1 Offline
MM club member
*****

Registered: 1999-09-09
Posts: 1264
Loc: The Netherlands
WMI guys...

How can I Remotely get the @ProductType and @SysLang information???
_________________________
Greetz,
Patrick Rutten

- We'll either find a way or make one...
- Knowledge is power; knowing how to find it is more powerful...
- Problems don't exist; they are challenges...

Top
#92639 - 2003-08-20 03:35 PM Re: WMI?? Howto Remotely get @ProductType and @SysLang
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
for producttype, look at:
http://www.kixtart.org/board/ultimatebb.php?ubb=get_topic;f=12;t=000019

for language... it depends do you want the locale of the user or the system?
for machine info:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\WOW\boot.description

for user:
HKEY_USERS\.DEFAULT\Control Panel\International
_________________________
!

download KiXnet

Top
#92640 - 2003-08-20 11:48 PM Re: WMI?? Howto Remotely get @ProductType and @SysLang
kholm Offline
Korg Regular
*****

Registered: 2000-06-19
Posts: 714
Loc: Randers, Denmark
Patrick

Try this:
code:
? OS_Info('.')     ; Get Info for: local WS
? OS_Info('PC099') ; Get Info for: PC099
Get $x

Function OS_Info($Computer)
Dim $oWMIService,$ItemS,$Item

$oWMIService = GetObject("winmgmts:\\" + $Computer + "\root\cimv2")
$ItemS = $oWMIService.ExecQuery("Select * from Win32_OperatingSystem where Primary=True")
For Each $Item In $ItemS
$OS_Info = $Item.Caption
$OS_Info = $OS_Info + ',' + $Item.OSLanguage
Next
EndFunction

The function: OS_Info()
Returns: ProductType and ISO 639 number of OS-language separated by a comma

Examples of results:
Microsoft Windows XP Professional,0413 ; 0413 = Dutch
Microsoft Windows XP Professional,1030 ; 1030 = Danish
Microsoft Windows XP Professional,1033 ; 1033 = English

-Erik

Top
#92641 - 2003-08-21 09:36 AM Re: WMI?? Howto Remotely get @ProductType and @SysLang
MightyR1 Offline
MM club member
*****

Registered: 1999-09-09
Posts: 1264
Loc: The Netherlands
Works like a charm...

had a temp solution myself by looking at the notepad version and language...
_________________________
Greetz,
Patrick Rutten

- We'll either find a way or make one...
- Knowledge is power; knowing how to find it is more powerful...
- Problems don't exist; they are challenges...

Top
#92642 - 2003-08-21 11:46 AM Re: WMI?? Howto Remotely get @ProductType and @SysLang
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
so you could WMIQuery() it

WMIQuery('Caption','Win32_OperatingSystem',$computer,'Primary','True')
WMIQuery('OSLanguage','Win32_OperatingSystem',$computer,'Primary','True')
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#92643 - 2003-08-21 11:59 AM Re: WMI?? Howto Remotely get @ProductType and @SysLang
MightyR1 Offline
MM club member
*****

Registered: 1999-09-09
Posts: 1264
Loc: The Netherlands
Why I needed this...



;****************************************************************************
;
;SCRIPT/FUNCTION : RPC.kix
;
;ACTION          : Remotely installs the Q823980 - Blaster patch
;
;AUTHOR          : Patrick Rutten (MightyR1@hotmail.com)
;
;CONTRIBUTORS    : Paul Giebelen
;                  KHolm
;
;SCRIPT VERSION  :
;                  1.0.0.0 - 2003-08-21
;                    History
;
;SYNTAX          : -
;
;PARAMETERS      : -
;
;RETURNS         : -
;
;REMARKS         : -
;
;DEPENDENCIES    : RenameAdmin.exe (ra.exe)
;                    http://mywebpages.comcast.net/habullock/
;                  PsExec.exe
;                    http://www.sysinternals.com
;                  KB823980Scan.exe
;                    http://www.microsoft.com
;
;EXAMPLE(S)      : 
;
;KNOWN ISSUES    : 
;
;KIXTART VERSION : 
; 
;KIXTART BBS     :
;
;****************************************************************************
;
;

;Enable Break to allow killing the script without logoff
Break on

;Set some global options
$rc=SetOption('NoVarsInStrings','ON')
$rc=SetOption('HideCursor','ON')
$rc=SetOption('Explicit','ON')

;Declare variables
Dim $BlasterScan,$Results,$line
Global $Notpatched

;assign Variables
$Notpatched=@SCRIPTDIR+'\Notpatched.txt'
$BlasterScan=@SCRIPTDIR+'\KB823980Scan.exe'
$Results=@SCRIPTDIR+'\Vulnerable.txt'
 
Del $NotPatched

;Scan network for Blaster vulnerabilities usin M$ tool
Shell '%comspec% /c '+$BlasterScan+' /o:'+$Results+' start_scan_address-stop_scan_address'
? ? ?

;If vulnerabilities were found, read the results file containing IP addresses and apply patch
If NOT Open(1,$results)
 $line=ReadLine(1)
 While $line
  $rc=UpdateRPC($line) 
  $line=ReadLine(1)
 Loop
 $rc=Close(1)
EndIf

;Exit the script
Exit 0

;****************************************************************************
;
;ADDITIONAL FUNCTIONS
;
;
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Function UpdateRPC($pc)

;Declare variables
Dim $RPCver,$os,$lng,$user,$pw,$patchname,$patchsrc,$patchdst
Dim $ra,$psexec,$notepadver,$notepadlng,$info

 ;Assign variables
 $ra=@SCRIPTDIR+'\ra.exe'
 $psexec=@SCRIPTDIR+'\psexec.exe'
 
 ;Get OS information
 $info=OS_Info($pc)
 
 ;Determine if OS is W2k and Dutch
 $os=InStr($info,'Windows 2000')
 $lng=InStr($info,'1043')
 
 $pc='\\'+$pc
 
 ;If C$ can be connected
 If Exist($pc+'\C$')
  $RPCver=GetFileVersion($pc+'\admin$\system32\Rpcrt4.dll','Productversion')

  ;If W2k and dutch and wrong RPC version copy files to workstation and apply patch
  If $os AND $lng AND $RPCver <> '5.00.2195.6753'
   $user='Administrator'
   $pw='adminpassword'
   
;   If NOT Exist($pc+'\c$\patches')
    ;Change local administrator password using Howard Bullock's executable
    Shell '%comspec% /c '+$ra+' '+$pc+' '+$user+' '+$pw+' > nul'
    ;Make a c$\patches folder
    MD $pc+'\c$\patches'
;   EndIf

   ;Copy the patch
   $patchname='Q823980-W2k-NLD.exe'
   $patchsrc='\\midict01\rm$\security\Q823980\'+$patchname
   $patchdst=$pc+'\c$\patches\'+$patchname
   Copy $patchsrc $patchdst
   
   ? ?

   ;Remotely execute the patch using psExec
   Shell '%comspec% /c '+$psexec+' '+$pc+' -u '+$user+' -p '+$pw+' -d '+$patchdst+' /q /u /z'
   ? $pc+Chr(9)+' Blaster patch was executed...'
 
  ;No w2k/dutch
  Else
   ? ? $pc+Chr(9)+' is not a valid machine. Take actions manually!!!'
   $rc=WriteProfileString($Notpatched,'Invalid',$pc,'is not a valid machine. Take actions manually!!!')
  EndIf
 
 ;C$ not accessible
 Else
  ? ? $pc+Chr(9)+' Has no C$ or is not accessible...'
  $rc=WriteProfileString($Notpatched,'Not Patched',$pc,'Has no C$ or is not accessible...')
 EndIf
EndFunction

;Function got from KHOLM
Function OS_Info($Computer)
    Dim $oWMIService,$ItemS,$Item
   
    $oWMIService = GetObject("winmgmts:\\" + $Computer + "\root\cimv2")
    $ItemS = $oWMIService.ExecQuery("Select * from Win32_OperatingSystem where Primary=True")
    For Each $Item In $ItemS
      $OS_Info = $Item.Caption
      $OS_Info = $OS_Info + ',' + $Item.OSLanguage
    Next
EndFunction

_________________________
Greetz,
Patrick Rutten

- We'll either find a way or make one...
- Knowledge is power; knowing how to find it is more powerful...
- Problems don't exist; they are challenges...

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 2009 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

Generated in 0.054 seconds in which 0.024 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