Sign in to follow this  
Followers 0
ioliver

RunWait () & PSInfo.exe

5 posts in this topic

Ok, here's my code...

$objComputers = FileOpen("c:\adcomputers.csv", 0); Opens the file c:\adcomputers.csv for Reading

; Read in lines of text until the EOF is reached
;While 1
   ;$Computer = FileReadLine($objComputers)
    $Computer = "br7spare1"
;If @error = -1 Then ExitLoop
    RunWait(@ComSpec & ' /c ' & 'psinfo -s \\' & $Computer & ' | find "Office" > c:\off_' & $Computer & '.txt')
    
;Wend

You need to have PSInfo.exe on your C: Drive for it to work.

When I run the command:

psinfo -s \\COMPUTERNAME | find "Office" > c:\off_COMPUTERNAME.txt

from a Command Line it works fine. But my above code does not seem to work.

Please let me know if you spot the error.

Thanks,

Ian


"Blessed be the name of the Lord" - Job 1:21Check out Search IMF

Share this post


Link to post
Share on other sites



Ok, here's my code...

$objComputers = FileOpen("c:\adcomputers.csv", 0); Opens the file c:\adcomputers.csv for Reading

; Read in lines of text until the EOF is reached
;While 1
  ;$Computer = FileReadLine($objComputers)
    $Computer = "br7spare1"
;If @error = -1 Then ExitLoop
    RunWait(@ComSpec & ' /c ' & 'psinfo -s \\' & $Computer & ' | find "Office" > c:\off_' & $Computer & '.txt')
    
;Wend

You need to have PSInfo.exe on your C: Drive for it to work.

When I run the command:

psinfo -s \\COMPUTERNAME | find "Office" > c:\off_COMPUTERNAME.txt

from a Command Line it works fine.  But my above code does not seem to work.

Please let me know if you spot the error.

Thanks,

Ian

<{POST_SNAPBACK}>

I notice that you have the ; in front of alot of the commands. The ; acts as a comment so anything after it isn't interperted by autoit as anything to execute. Remove the ; and give it a try. Here it is revised.

$objComputers = FileOpen("c:\adcomputers.csv", 0); Opens the file c:\adcomputers.csv for Reading

; Read in lines of text until the EOF is reached
While 1
    $Computer = FileReadLine($objComputers)
    $Computer = "br7spare1"
If @error = -1 Then ExitLoop
    RunWait(@ComSpec & ' /c ' & 'psinfo -s \\' & $Computer & ' | find "Office" > c:\off_' & $Computer & '.txt')
    
Wend

Jeff

Share this post


Link to post
Share on other sites

Thanks Jeff,

I had those lines commented out for testing. Instead of reading from a file I just assigned a value to the variable $Computer, just to eliminate that as a possible problem.

Thanks again for your help,

Ian


"Blessed be the name of the Lord" - Job 1:21Check out Search IMF

Share this post


Link to post
Share on other sites

Ian,

I have some headaches as well sometimes when trying to run a @Comspec command. I try to spend sometime working it out, but when I get bored with the issue, then I go for the _RunDos() function that someone posted awhile back and is now included as part of the install. I don't know why it works better, but it usually is more successfull. Also, don't forget the #include file.

#Include <process.au3>

$sCommand = "psinfo -s \\COMPUTERNAME | find "Office" > c:\off_COMPUTERNAME.txt"

_RunDOS( $sCommand )

Jason :)


jason7237

Share this post


Link to post
Share on other sites
:D uh, sorry, watch the " marks that I left in the code above. You might want to adjust that. :evil::)

jason7237

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