Sign in to follow this  
Followers 0

Admin Tool

137 posts in this topic

#1 ·  Posted (edited)

This started as a way to learn more about wmi and ldap

Removed any info pertaining to my work-place, so info in ini will need to be changed

The ldap method worked, but was to slow amongst other things, so used net view to

get the browser info for systems online on the domain, haven't had time to figure out

a better way (maybe active directory)

link to external free tools used Sysinternals PSTools

Currently it (requires beta)

gets the list of pc's online on domain and populates a listview

populates 6 listviews

Tab 1:

Software that can be removed via msiexec command silently and remotely (right click,

select uninstall) (list populated using wmi)

Tab 2:

List of PID, process names, and paths, and (right click, select kill "uses wmi") remote

process (list populated using wmi)

Tab 3:

Services (list populated using wmi) (right click, select stop/start/pause/restart/delete service

using wmi)

Tab 4:

Some system info in editbox

List of Logged on users (using psloggedon from sysinternals)

Drive information (Drive Letter, type, size, free space, format type i.e ntfs using wmi), right

clicking on drive can explore remote drive (configured in ini to use iexplorer))

Tab 5:

List of all applications installed on the remote machine (using psinfo from sysinternals)

Plan on adding more, for example export of data.

Comments/suggestions/improvements are most welcome.

CODE

Edit: v1.9.1.4

Fixed up the IP Range Filtering Function (back-spacing, tabs, length)

Also fixed so that Filter is updated imediatly so that refresh can be done right away.

Edit: v1.9.1.3

Added IP Range Filtering

Edit: v1.9.1.2

Added a couple of context menu items, look for them in the machine list

Some code optimization, also took some of the code out of the main loop and put into functions

Edit: v1.9.1.1

Ping time out configurable

Checks to see what $Domain is, if it is equal to "your-domain" then

the domain configscreen will pop up (doesn't populate machine list

if it is equal to "your-domain").

Must change to your domains name.

Context menu for populate software instead of $GUI_EVENT_PRIMARYDOWN

Selecting machine through search does not automatically populate pc info anymore

(might have populate for one not wanted)

If machine filter changes, no longer automatically re-populates list, will have to

selectRefresh Machine List from context menu

Edit: v1.9.1.0

User now has choice of retrieving list of pcs by either ldap or net view, select config menu

some internal changes.

Edit: v1.9:

I replaced the net view with the retrievial of the pcs with ldap

Added the ip address to the machine list

All pcs will have the offline icon at this time, select one if it is pingable it changes the

icon to online

Edit:

corrected error with context menu on services

Edit: v1.8

added Change Start Mode to Services (Boot,System,Automatic,Manual,Disabled)

Edit: v1.7

now using all wmi for process and service tabs, no longer need pskill and psservice

from sysinternals, Changed from label to editbox read-only for system info on Tab 4

Edit: v1.6

since there seems to be some interest (47 downloads of 1st version) I decided to put

the latest up, added all the files need from sysinternals into the zip file.

Enjoy,

Gary

Edited by Jon
1 person likes this

SciTE for AutoItDirections for Submitting Standard UDFs


Don't argue with an idiot; people watching may not be able to tell the difference.

Share this post


Link to post
Share on other sites



#2 ·  Posted

I did something like this a year ago, I haven't updated it in a while, although someone asked me to post the scripts again because the file manager no longer had them. It was pretty similar to this.

Domain PC Info

Share this post


Link to post
Share on other sites

#3 ·  Posted

Please post complete topic..

Or GUIListview.au3 file

Share this post


Link to post
Share on other sites

#4 ·  Posted

Please post complete topic..

Or GUIListview.au3 file

Beta


SciTE for AutoItDirections for Submitting Standard UDFs


Don't argue with an idiot; people watching may not be able to tell the difference.

Share this post


Link to post
Share on other sites

#5 ·  Posted

This is pretty lavish, Gary. Nice work!

Comments/suggestions/improvements are most welcome.

Gary

StdoutRead makes everything better. ;) I don't know if the Sysinternals tools use STDERR in the case of a problem (surely they do) but you could read the native error message with StderrRead if that were the case...


Yes yes yes, there it was. Youth must go, ah yes. But youth is only being in a way like it might be an animal. No, it is not just being an animal so much as being like one of these malenky toys you viddy being sold in the streets, like little chellovecks made out of tin and with a spring inside and then a winding handle on the outside and you wind it up grrr grrr grrr and off it itties, like walking, O my brothers. But it itties in a straight line and bangs straight into things bang bang and it cannot help what it is doing. Being young is like being like one of these malenky machines.

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

This is pretty lavish, Gary. Nice work!

StdoutRead makes everything better. :P I don't know if the Sysinternals tools use STDERR in the case of a problem (surely they do) but you could read the native error message with StderrRead if that were the case...

Thanks ;)

I forced one of the tools to error, but stderr didn't get any info

Updated AdminTool, see first post

Gary

Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs


Don't argue with an idiot; people watching may not be able to tell the difference.

Share this post


Link to post
Share on other sites

#7 ·  Posted

v1.7 now using all wmi for process and service tabs, no longer need pskill and psservice from sysinternals

see 1st post

Enjoy,

Gary


SciTE for AutoItDirections for Submitting Standard UDFs


Don't argue with an idiot; people watching may not be able to tell the difference.

Share this post


Link to post
Share on other sites

#8 ·  Posted

v1.7 now using all wmi for process and service tabs, no longer need pskill and psservice from sysinternals

see 1st post

Enjoy,

Gary

Is there an easy way to get it to work on a workgroup instead of a domain. All my customers use peer to peer networks as they are not large enough to require servers.


Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

#9 ·  Posted

I tried it at home (no domain), just MyHome workgroup, and it worked


SciTE for AutoItDirections for Submitting Standard UDFs


Don't argue with an idiot; people watching may not be able to tell the difference.

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

I tried it at home (no domain), just MyHome workgroup, and it worked

I must be doing something wrong, I will try again.

Edit

I have tried it again and it sees all three computers. It comes up with an error on one computer (see attached). It also cant ping the computer it is running on.

Edited by BigDod


Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

#11 ·  Posted

I was wrong, thought i had to setup this network up in workgroup, but it's a domain thru my router.


SciTE for AutoItDirections for Submitting Standard UDFs


Don't argue with an idiot; people watching may not be able to tell the difference.

Share this post


Link to post
Share on other sites

#12 ·  Posted

v1.8 added Change Start Mode to Services (Boot,System,Automatic,Manual,Disabled)

Adding as I learn/figure things out.

see 1st post


SciTE for AutoItDirections for Submitting Standard UDFs


Don't argue with an idiot; people watching may not be able to tell the difference.

Share this post


Link to post
Share on other sites

#13 ·  Posted

First

Looks real nice gafrost.... good job

Second

it did not work for me

Win Xp SP2

Shared network through router

I use "net send" and that works

Third

I tried this and it worked inside your script ... but still no info ???

I added these to your existing script because I did not know the answer to "your-domain"

Global Const $wbemFlagForwardOnly = 0x20
Dim $set_Domain, $s_Domain; ************ added this line
opt('MustDeclareVars', 1)

*************************** and *********************************

If $s_Domain = "your-domain" Then;*************** added from here
        Set_Domain()
        Local $domain_input = GUICtrlCreateCombo("your-domain", 20, 40, 250, 20)
        GUICtrlSetState(-1,$GUI_FOCUS) 
        GUICtrlSetData(-1,$set_Domain)
    Else    
        Local $domain_input = GUICtrlCreateInput($s_Domain, 20, 40, 250, 20)
    EndIf;**************to here
    $Save = GUICtrlCreateButton("Save", 20, 100, 120, 25)
    $CLOSE = GUICtrlCreateButton("Close", 160, 100, 120, 25)
    GUISetState()


************************* and ***********************************

; **************************** all of this function below

Func Set_Domain()

    Local $file, $line, $result, $blankpos,  $len
;delete last listing
Filedelete(@TempDir & "\b.tmp")

; make sure net send is running
RunWait("net start messenger","",@SW_HIDE)

;gets the computer list and a few other things
RunWait(@ComSpec & ' /c net view > ' & @TempDir & '\a.tmp',"", @SW_HIDE)
Sleep(300)
;open the file for working
$file = FileOpen(@TempDir & "\a.tmp", 0)

; Check if file opened for reading OK
If $file = -1 Then
    MsgBox(0, "QT - Error", "Unable to open file.")
    Exit
EndIf

;Creates new file in which the result will be written
FileOpen(@TempDir & "\b.tmp", 1)

; Read in lines of text until the EOF is reached in file a.tmp
While 1
    $line = FileReadLine($file)
    If @error = -1 Then ExitLoop
  ;find the string "\\"
    $result = StringInStr($line,"\\")
      if $result = 1 Then 
     ;find next blank
      $blankpos = StringInStr($line," ")
    ;Find length of line
      $len = StringLen($line)
    ;calculate from what position to Trim string to the right
      $len = $len - $blankpos
    ;Trim all characters after the computer name
      $line = StringTrimRight($line, $len)
    ;Trim the //
      $line = StringTrimLeft($line,2)
    ;Write line to file, adding "|"
      FileWrite(@TempDir & "\b.tmp", $line & "|")
      EndIf

Wend

FileClose($file)
FileDelete(@TempDir & "\a.tmp")
$set_Domain = FileReadline(@TempDir & "\b.tmp", 1)


EndFunc

it worked... gave me choices and no errors... i saved it... closed it....

and again no info????

8)


Ad_Smallest_zpsjjqeqtel.jpg

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

First

Looks real nice gafrost.... good job

Second

it did not work for me

Win Xp SP2

Shared network through router

I use "net send" and that works

Third

I tried this and it worked inside your script ... but still no info ???

I added these to your existing script because I did not know the answer to "your-domain"

Global Const $wbemFlagForwardOnly = 0x20
Dim $set_Domain, $s_Domain; ************ added this line
opt('MustDeclareVars', 1)

*************************** and *********************************

If $s_Domain = "your-domain" Then;*************** added from here
        Set_Domain()
        Local $domain_input = GUICtrlCreateCombo("your-domain", 20, 40, 250, 20)
        GUICtrlSetState(-1,$GUI_FOCUS) 
        GUICtrlSetData(-1,$set_Domain)
    Else    
        Local $domain_input = GUICtrlCreateInput($s_Domain, 20, 40, 250, 20)
    EndIf;**************to here
    $Save = GUICtrlCreateButton("Save", 20, 100, 120, 25)
    $CLOSE = GUICtrlCreateButton("Close", 160, 100, 120, 25)
    GUISetState()


************************* and ***********************************

; **************************** all of this function below

Func Set_Domain()

    Local $file, $line, $result, $blankpos,  $len
;delete last listing
Filedelete(@TempDir & "\b.tmp")

; make sure net send is running
RunWait("net start messenger","",@SW_HIDE)

;gets the computer list and a few other things
RunWait(@ComSpec & ' /c net view > ' & @TempDir & '\a.tmp',"", @SW_HIDE)
Sleep(300)
;open the file for working
$file = FileOpen(@TempDir & "\a.tmp", 0)

; Check if file opened for reading OK
If $file = -1 Then
    MsgBox(0, "QT - Error", "Unable to open file.")
    Exit
EndIf

;Creates new file in which the result will be written
FileOpen(@TempDir & "\b.tmp", 1)

; Read in lines of text until the EOF is reached in file a.tmp
While 1
    $line = FileReadLine($file)
    If @error = -1 Then ExitLoop
;find the string "\\"
    $result = StringInStr($line,"\\")
      if $result = 1 Then 
    ;find next blank
      $blankpos = StringInStr($line," ")
  ;Find length of line
      $len = StringLen($line)
  ;calculate from what position to Trim string to the right
      $len = $len - $blankpos
  ;Trim all characters after the computer name
      $line = StringTrimRight($line, $len)
  ;Trim the //
      $line = StringTrimLeft($line,2)
  ;Write line to file, adding "|"
      FileWrite(@TempDir & "\b.tmp", $line & "|")
      EndIf

Wend

FileClose($file)
FileDelete(@TempDir & "\a.tmp")
$set_Domain = FileReadline(@TempDir & "\b.tmp", 1)


EndFunc

it worked... gave me choices and no errors... i saved it... closed it....

and again no info????

8)

no need to add to script, i just put a dummy domain name in the ini, either edit the ini and change to name of your domain or load program, because domain doesn't exist will take a few moments to finish loading

then select config, domain, then change it to your domain name

This has only been tested on WinXP Pro SP2 on a domain.

Gary

Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs


Don't argue with an idiot; people watching may not be able to tell the difference.

Share this post


Link to post
Share on other sites

#15 ·  Posted

then... it wont work i guess

Win Xp Home Sp2

Shared access ( hand under hard-drives)

net-send working

anything i can try

?

8)


Ad_Smallest_zpsjjqeqtel.jpg

Share this post


Link to post
Share on other sites

#16 ·  Posted

try commenting out the

If $ping_time Then

and corresponding endif's

ping might be the problem, had that problem on one of my machines here at home, turned off the software firewall for a minute and the ping worked.


SciTE for AutoItDirections for Submitting Standard UDFs


Don't argue with an idiot; people watching may not be able to tell the difference.

Share this post


Link to post
Share on other sites

#17 ·  Posted (edited)

i did this...no errors, but no info

 Local $ping_time = Ping($s_Machine)                     ;If $ping_time Then                        GUICtrlSetData($Status, $s_Machine & " roundtrip was:" & $ping_time & " ms")                        _GUICtrlListViewDeleteAllItems ($lv_software)                        _GUICtrlListViewDeleteAllItems ($lv_allsoftware)                        _GUICtrlListViewDeleteAllItems ($lv_pid)                        _GUICtrlListViewDeleteAllItems ($lv_services)                        _GUICtrlListViewDeleteAllItems ($lv_drives)                        _GUICtrlListViewDeleteAllItems ($lv_loggedin)                        GUICtrlSetData($Status, "Getting Role: " & $s_Machine)                        GUICtrlSetImage(_GUICtrlListViewGetItemText ($lv_pcs, -1, 1), @ScriptDir & "\OnLine.ico")                        GUISetState(@SW_LOCK)                        _GetRole ($s_Machine, $Status)                        GUISetState(@SW_UNLOCK)                        GUISetState(@SW_LOCK)                        _RetrieveSoftware ($lv_software, $s_Machine)                        _RetrieveAllSoftware ($lv_allsoftware, $s_Machine)                        _RetieveOSInfo ($eb_system, $s_Machine)                        _RetrieveProcessList ($lv_pid, $s_Machine)                        _RetrieveServices ($lv_services, $s_Machine)                        _RetrieveLoggedInUsers ($lv_loggedin, $s_Machine)                        _DriveInfo ($lv_drives, $s_Machine)                        GUISetState(@SW_UNLOCK)                    ; Else                        ;GUICtrlSetData($Status, $s_Machine & " is Offline")                        ;GUICtrlSetImage(_GUICtrlListViewGetItemText ($lv_pcs, -1, 1), @ScriptDir & "\OffLine.ico")                    ; EndIf                     GUISetCursor($Cursor_ARROW, 1)                  EndIf[code=auto:0]8)


            
                


    Edited  by Valuater
    
    

            
        

        
            
                

    
        
            
        
    


            
        

        
            
                
                
                
            
            
                
            
        
        
            




  
  
    
  



        
    

    
        
            Share this post
            
Link to post
            
            
                Share on other sites
                

    
        
            

    

        
            

    

        
            

    

        
            

    

        
            

    

        
    

            
        
    


    

                    
                
                    
                    
                    






    
    
        
Valuater   

    
        
    
             63
    
        
    

        
            
                www.PayFreeWireless.com
            
            
                
            

            
                

    
        
    

            
            MVPs
            
                
            
            
                

    
        
    
             63
    
        
    

                11,045 posts
                
                

            
        
    
    
        


    
        
            
            
            
        

        
    #18 · 
            Posted 
            
                (edited)
            
            
            
        
    

    


    
        
        
        
            this worked... no error

$var = Ping("BLINGBLING",250)
If $var Then; also possible:  If @error = 0 Then ...
    Msgbox(0,"Status","Online, roundtrip was:" & $var)
Else
    Msgbox(0,"Status","An error occured with number: " & @error)
EndIf

8)

EDIT

it also worked on my other two computers from BLINGBLING running the script

Edited by Valuater

Ad_Smallest_zpsjjqeqtel.jpg

Share this post


Link to post
Share on other sites

#19 ·  Posted

Are you getting a list of pcs in the left list?

if not, then try the following replacing MyHome with your domain name

net view /domain:MyHome

if so then try the following replacing GAF with your machine name:

Global Const $wbemFlagReturnImmediately = 0x10
Global Const $wbemFlagForwardOnly = 0x20
$s_Machine = "GAF"

$objWMIService = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\" & $s_Machine & "\root\cimv2")
If @error Then
 MsgBox(16, "Test wmi", "ObjGet Error: winmgmts")
 Exit
EndIf
$colSoftware = $objWMIService.ExecQuery ("Select * from Win32_Product", "WQL", _
  $wbemFlagReturnImmediately + $wbemFlagForwardOnly)
If @error Then
 MsgBox(16, "Test wmi", "ExecQuery Error: Select * from Win32_Product")
 Exit
EndIf
For $objSoftware In $colSoftware
 If $objSoftware.Caption <> "0" Then
  MsgBox(0, "Test wmi", "Caption: " & $objSoftware.Caption & @LF & _
    "Version: " & $objSoftware.Version & @LF & _
    "IdentifyingNumber: " & $objSoftware.IdentifyingNumber)
 EndIf
Next

SciTE for AutoItDirections for Submitting Standard UDFs


Don't argue with an idiot; people watching may not be able to tell the difference.

Share this post


Link to post
Share on other sites

#20 ·  Posted (edited)

OK... we got some where

i changed this... net view /domain:MyHome

to my local network name

And **** Admin Tools **** worked

i got the three comp pics on the left and it gave me the info for BLINGBLING

... but it says "Unable to retrieve Role" at the bottom of the screen

****** then

i tried to get info on another comuter and it keep locking up with error messages... this is the first one

then the ProcessList error

then i had to hard stop it with ctrl-alt-del

but thats progress... right??

8)

.

ALSO

Your code above worked with BLINGBLING

Edited by Valuater

Ad_Smallest_zpsjjqeqtel.jpg

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0