Sign in to follow this  
Followers 0
SpookMeister

How would you do it?

3 posts in this topic

Here's the scenario:

I have a bunch of PC's all either Win2K or XP sitting on a particular subnet. However they are not alone on the subnet, it also contains a few other network devices even a few PC's that I specifically DO NOT want to perform actions on. Fortunately, all of the PC's I desire to address follow a unique naming convention IE (DW25, DW104, DW152, etc.)

I want each of my target PCs to execute a file located at "\\server\share\executable.exe"

I think I have a grip on the remote execution side of it (psexec from sysinternals) but I'm looking for ideas on the subnet scanning / identifying my target pcs side. Or perhaps you have a better method entirely... either way, the help is appreciated.

Oh, if your wondering why I didnt go with a login script in an active directory group policy.... I tried it, but ran into issues with the program running twice per login. Which caused other issues... blah blah blah.


[u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote]

Share this post


Link to post
Share on other sites



for $i = 1 to 152 ; or whatever topend you want

if ping DW & $i then run(psexec DW & $i.....

next


[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

$pc_names = _RetrieveComputersLdap(@LogonDomain, "DW")
If IsArray($pc_names) Then
   For $x = 1 To $pc_names[0]
      MsgBox(0, "test", $pc_names[$x])
   Next
EndIf

Func _RetrieveComputersLdap($Domain, $filter)
   Local $ObjDomain = ObjGet("WinNT://" & $Domain)
   Local $pc_name, $pcs
   For $Object In $ObjDomain
      $ip_address = ""
      If $Object.class = "Computer" Then
         $pc_name = $Object.Name
         $inFilter = 0
         If StringUpper(StringMid($pc_name, 1, StringLen($filter))) = StringUpper($filter) Then
            If Not IsArray($pcs) Then
               Dim $pcs[1]
            EndIf
            ReDim $pcs[UBound($pcs) + 1]
            $pcs[0] = UBound($pcs)
            $pcs[UBound($pcs) - 1] = $pc_name
         EndIf
      EndIf
   Next
   Return $pcs
EndFunc  ;==>_RetrieveComputersLdap


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

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