Jump to content

Admin Tool


GaryFrost
 Share

Recommended Posts

Originally I had the code traversing the ldap, problem with that is i had to traverse each ou, not sure how to get just a subnet

the domain at work usally has about 2500 to 2700 pcs online at any given time, if my filter is setup up to show all pcs online, doesn't take very long to load the way the program is setup at this time, this is why i created the fuzzy search.

as to the problem your having not sure at this time, need to goto the case statement for $GUI_EVENT_PRIMARYDOWN and comment out the following

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

that would only leave two functions when a pc is selected

_GetRole ($s_Machine, $Status)

_RetrieveSoftware ($lv_software, $s_Machine)

if you don't get errors from those functions and it populates the software

then onto the next function, till find what the problem is.

if you get errors from either the GetRole or the _RetrieveSoftware functions, then can narrow the problem down.

Script is is showing PCs those are only visible in "My Network Places"...

Here in our domain Workstations are not Visible.. If you dont have time just give me an idea to add feature to scan Subnet.

Link to comment
Share on other sites

Script is is showing PCs those are only visible in "My Network Places"...

Here in our domain Workstations are not Visible.. If you don't have time just give me an idea to add feature to scan Subnet.

Haven't found any info on just retrieving computers from subnet yet, but if you have them broke up by ou you could do it that way

Havne't tested this, not at work, but I had something similar when I first started the project, problem was gave me all the systems in the ou, not just the ones online.

example:

; yourdomain.com with an ou in computers called MySubNet


$colComputers = GetObject("LDAP://OU=MySubnet, CN=Computers, DC=yourdomain, DC=com")
For $objComputer in $colComputers
      $strComputer = $objComputer.CN
  MsgBox(0,"Computer",$strComputer)
Next
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.

 

Link to comment
Share on other sites

Haven't found any info on just retrieving computers from subnet yet, but if you have them broke up by ou you could do it that way

Havne't tested this, not at work, but I had something similar when I first started the project, problem was gave me all the systems in the ou, not just the ones online.

example:

; yourdomain.com with an ou in computers called MySubNet
$colComputers = GetObject("LDAP://OU=MySubnet, CN=Computers, DC=yourdomain, DC=com")
For $objComputer in $colComputers
      $strComputer = $objComputer.CN
  MsgBox(0,"Computer",$strComputer)
Next
My admin tool will allow you to show only PCs on your subnet, it's not extremely quick, unfortunately AutoIt isn't threaded.
Link to comment
Share on other sites

Then Post that or mail to rrohela@yahoo.com

http://www.autoitscript.com/forum/index.ph...owtopic=6850&hl=

not all the files are there that you need, you'll have to hunt for them

if i get time this week i'll see if i can figure out a better/faster way to get the pc's from a subnet.

SciTE for AutoItDirections for Submitting Standard UDFs

 

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

 

Link to comment
Share on other sites

you might also try using the objects in the beta instead of external vbs scripts

example:

Global Const $wbemFlagReturnImmediately = 0x10
Global Const $wbemFlagForwardOnly = 0x20
$strComputer = @ComputerName
Dim $a_info[14]
$a_info[0] = 13
$oReg = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
$objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\cimv2")
$colItems = $objWMIService.ExecQuery ("Select Caption, ServicePackMajorVersion, InstallDate, LastBootUpTime from Win32_OperatingSystem","WQL", _
   $wbemFlagReturnImmediately + $wbemFlagForwardOnly)
For $objItem In $colItems
   $a_info[1] = "OS: " & $objItem.Caption
   $a_info[2] = "Service Pack: " & $objItem.ServicePackMajorVersion
   $a_info[3] = "Install: " & $objItem.InstallDate
   $a_info[4] = "Last Boot: " & $objItem.LastBootUpTime
Next
$objWbem = ObjGet("winmgmts:\\" & $strComputer)
$objWbemObjectSet = $objWbem.ExecQuery ("Select Vendor, Name, IdentifyingNumber From Win32_ComputerSystemProduct","WQL", _
   $wbemFlagReturnImmediately + $wbemFlagForwardOnly)
For $objWbemObject In $objWbemObjectSet
   $a_info[5] = "Vendor: " & $objWbemObject.Vendor
   $a_info[6] = "Model: " & $objWbemObject.Name
   $a_info[7] = "Serial: " & $objWbemObject.IdentifyingNumber
Next
$colAdapters = $objWMIService.ExecQuery ("Select * from Win32_NetworkAdapterConfiguration Where IPEnabled = True","WQL", _
   $wbemFlagReturnImmediately + $wbemFlagForwardOnly)
For $objAdapter In $colAdapters
   $a_info[8] = "IP: " & $objAdapter.IPAddress (0)
   $a_info[9] = "MAC: " & $objAdapter.MACAddress
 If $objAdapter.DHCPEnabled Then
  $a_info[10] = "DHCP: True"
 Else
  $a_info[10] = "DHCP: False"
 EndIf
   $a_info[11] = "Subnet: " & $objAdapter.IPSubnet (0)
   $a_info[12] = "Gateway: " & $objAdapter.DefaultIPGateway (0)
Next
$Service = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\" & $strComputer & "\root\cimv2")
$ObjectSet = $Service.InstancesOf ("Win32_ComputerSystem")
For $Object In $ObjectSet
   If Not $Object.Username Then
      $a_info[13] = "Not Logged In"
   Else
      $a_info[13] = "Username: " & $Object.Username
   EndIf
Next
For $memory In $objWMIService.InstancesOf ("Win32_PhysicalMemory")
 ReDim $a_info[UBound($a_info) + 1]
 $a_info[0] += 1
   $a_info[UBound($a_info) - 1] = "RAM: " & $memory.capacity
Next

For $x = 1 To $a_info[0]
   ConsoleWrite($a_info[$x] & @LF)
Next

look similar to any functions in your script?

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.

 

Link to comment
Share on other sites

I get the following error (used stars to block out my username)

Line 236 (File c:\winnt\profiles\******\Desktop\Admintool\admintool.au3)

Case $ GUI_EVENt_CLOSE, $exititem

Error: "Case" statement with no matching "Select" Statement

I just loaded Autoit Beta v3.1.1.83 on my PC to get this to work.

Please advise.

thanks.

-Monkey

---"Educate the Mind, Make Savage the Body" -Mao Tse Tung

Link to comment
Share on other sites

I get the following error (used stars to block out my username)

Line 236 (File c:\winnt\profiles\******\Desktop\Admintool\admintool.au3)

Case $ GUI_EVENt_CLOSE, $exititem

Error: "Case" statement with no matching "Select" Statement

I just loaded Autoit Beta v3.1.1.83 on my PC to get this to work.

Please advise.

thanks.

-Monkey

Make sure you ran it using the beta, if using scite Alt+F5 or Tools, Beta Run

SciTE for AutoItDirections for Submitting Standard UDFs

 

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

 

Link to comment
Share on other sites

Script is is showing PCs those are only visible in "My Network Places"...

Here in our domain Workstations are not Visible.. If you don't have time just give me an idea to add feature to scan Subnet.

I looked at scanning for subnets today, way to slow for me, so at this time unless someone comes up with a fast way of scanning subnets i'll not add it to this project.

The net view /domain:domain-name gets the latest list from the browser of pc's online in the domain

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.

 

Link to comment
Share on other sites

I looked at scanning for subnets today, way to slow for me, so at this time unless someone comes up with a fast way of scanning subnets i'll not add it to this project.

The net view /domain:domain-name gets the latest list from the browser of pc's online in the domain

How quickly would you like to be able to scan for subnets? As long as the user knows it might take a while, it shouldn't be that big of a deal, that's why I made it an option. After switching from an external ping to TCPNameToIP, the time jumped from ~90 seconds down to about 7 for a domain of ~500 PCs. Major speed improvement for me at least. Side note, after reviewing my old code I realized one thing. I'm a lot smarter now than a year ago, my old code is WAY too sloppy, if I were to fix it, I would just start over. Let me know if you need any help, I'd be willing to contribute ideas if needed.

Edited by archrival
Link to comment
Share on other sites

using the net view I get a list of 2500 to 3000 in under 30 secs, that's the pc's online on the whole domain

Does it return an IP address for each machine as well? If so, there's minimal time and effort to determine if it's on the same subnet. 2500/500 = 5, 5x7 = 35 seconds... 5 extra seconds to determine subnet sounds fine to me.

As long as each PC is registered in DNS, the resolving to IP goes very quickly. It's when NetBIOS is involved that it takes time. I tried to make mine as home workgroup friendly as possible, obviously using net view will only show you PCs that have registered with the master browser in the domain. If you read from an NT or AD domain, you'll have a list of ALL Computers, regardless of online status, you'd have to determine afterwards whether or not they are online.

Edited by archrival
Link to comment
Share on other sites

Problem with finding out afterwards if 2500+ pcs are online takes time.

I'll have to try it with the current project and see how much time it takes, maybe i can get to it at work tomorrow.

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.

 

Link to comment
Share on other sites

Problem with finding out afterwards if 2500+ pcs are online takes time.

I'll have to try it with the current project and see how much time it takes, maybe i can get to it at work tomorrow.

What if the browser service is disabled? The remote machine won't show up in net view, depends who you are writing the script for. Yes, net view combined with retrieving PC names from the domain can give you a listing of online and offline PCs, but that's not always reliable either. PCs don't always notify the master browser that they are no longer available. Same with using DNS, if DHCP clients register with the DNS server, their record is still on the DNS server, even if they are no longer online. The only reliable way to verify if a machine is online would be to pull all machine names from the domain, ping them all (but then there's the case where firewalls block ICMP echos). It's never a complete science. Also using LDAP sort of negates non-2000 domains and workgroups, I haven't taken a close look at your code, but it's possible to do something like:

$PCs = ""
ObjDomain = ObjectGet(""WinNT://" & @LogonDomain)
For $Object in $ObjDomain
If $Object.class = "Computer" Then
$PCs = $PCs & $ObjDomain.Object
EndIf
Next

That's just off of the top of my head though. There is no sure-fire way to know whether or not a machine is actually online without contacting each and everyone, which takes time.

Link to comment
Share on other sites

$PCs = ""
$ObjDomain = ObjGet("WinNT://" & @LogonDomain)
TCPStartup()
For $Object in $ObjDomain
 If $Object.class = "Computer" Then
  ConsoleWrite($Object.Name & @TAB & TCPNameToIP($Object.Name) & @LF)
 EndIf
Next

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

Added the ip addres 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

See 1st post for source

SciTE for AutoItDirections for Submitting Standard UDFs

 

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

 

Link to comment
Share on other sites

Something i've run into, and not sure how to fix, i'm thinking SWbemLastError is needed to catch error, but not sure how to impliment if it can be

example

Func _RetrieveSoftware ($h_listview, $s_Machine)
 Local $even = 1, $i, $x, $items, $objWMIService, $colSoftware, $objSoftware
 $objWMIService = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\" & $s_Machine & "\root\cimv2")
 If @error Then
  MsgBox(16, "_RetrieveSoftware", "ObjGet Error: winmgmts")
  Return
 EndIf
 $colSoftware = $objWMIService.ExecQuery ("Select * from Win32_Product", "WQL", _
   $wbemFlagReturnImmediately + $wbemFlagForwardOnly)
 If @error Then
  MsgBox(16, "_RetrieveSoftware", "ExecQuery Error: Select * from Win32_Product")
  Return
 EndIf
;~ ********************************************************************
;~  no errors be it either hangs or takes forever to leave this loop

;~ if there is a problem, otherwise doesn't take long
;~ ********************************************************************
;~ testing using the wbemtest.exe eventually comes back with error
;~ 0x80041013 Provider Load Failure, use SWbemLastError ?
;~ ********************************************************************

 For $objSoftware In $colSoftware
  If $objSoftware.Caption <> "0" Then
   If IsArray($items) Then
    ReDim $items[UBound($items) + 1]
   Else
    Dim $items[1]
   EndIf
   $items[UBound($items) - 1] = $objSoftware.Caption & "|" & $objSoftware.Version & "|" & $objSoftware.IdentifyingNumber
  EndIf
 Next
 _ArraySort($items)
 _GUICtrlListViewDeleteAllItems ($h_listview)
 For $i = 0 To UBound($items) - 1
  Local $item = GUICtrlCreateListViewItem($items[$i], $h_listview)
  If $even Then
   $even = 0
   GUICtrlSetBkColor($item, 0xD1EEEE)
  Else
   $even = 1
  EndIf
 Next
 _GUICtrlListViewHideColumn ($h_listview, 2)
EndFunc  ;==>_RetrieveSoftware

Any help or ideas on how to solve this would greatly be appreciated.

Gary

SciTE for AutoItDirections for Submitting Standard UDFs

 

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

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...