#159847 - 2006-03-27 04:56 PM
Using an array?
|
Stephen Wintle
Seasoned Scripter
Registered: 2001-04-10
Posts: 444
Loc: England
|
Hi,
Could anyone give me some pointers on using an array to push out the following command Code:
Run "Beyondexecv2 \\" + $wrkid + " -d LockWorkstation -l 0"
Where $wrkid is passed the netbios name (this works ok), we have approx 32 machines for my array. So I want to repeat the command for every machine name.
Regards
Steve.
_________________________
Dont worry because a rival imitates you. As long as they follow in your tracks they cant pass you!
|
|
Top
|
|
|
|
#159849 - 2006-03-27 07:27 PM
Re: Using an array?
|
eriqjaffe
Hey THIS is FUN
Registered: 2004-06-24
Posts: 214
Loc: Arlington Heights, IL USA
|
Quote:
Assuming that you already know how to get the workstation name into an array....
Code:
For each $wkstn in $arry Run "Beyondexecv2 \\" + $wrkid + " -d LockWorkstation -l 0" Next
Shouldn't that be:
Code:
For each $wrkid in $arry Run "Beyondexecv2 \\" + $wrkid + " -d LockWorkstation -l 0" Next
|
|
Top
|
|
|
|
#159851 - 2006-03-28 10:10 AM
Re: Using an array?
|
Stephen Wintle
Seasoned Scripter
Registered: 2001-04-10
Posts: 444
Loc: England
|
Ok thanks, If I have machines numbered LT-01 to LT-32 how might I incorporate this into my array?
Regards
Steve.
_________________________
Dont worry because a rival imitates you. As long as they follow in your tracks they cant pass you!
|
|
Top
|
|
|
|
#159852 - 2006-03-28 10:26 AM
Re: Using an array?
|
NTDOC
Administrator
   
Registered: 2000-07-28
Posts: 11634
Loc: CA
|
Create a file with the names of the Computers you want to run it against. This code does not include code to verify the system is on or reachable.
Code:
$Computers = ReadFile(@ScriptDir+'\'+'computers.txt') For each $Computer in $Computers If $Computer $Computer = Trim($Computer) Run "Beyondexecv2 \\" + $Computer + " -d LockWorkstation -l 0" EndIf Next
Function ReadFile($file) Dim $lf, $f, $_, $t $lf=CHR(10) $f=FreeFileHandle $_=Open($f,$file) If @ERROR Exit @ERROR EndIf Do $t=$t+$lf+ReadLine($f) Until @ERROR $_=Close($f) $ReadFile=Split(SubStr($t,2),$lf) EndFunction
|
|
Top
|
|
|
|
#159855 - 2006-03-28 12:46 PM
Re: Using an array?
|
Stephen Wintle
Seasoned Scripter
Registered: 2001-04-10
Posts: 444
Loc: England
|
Ok,
Should the computer.txt script have machines names with breaklines so that each machine in in a column or do I seperate by comma?
regards
Steve.
|
|
Top
|
|
|
|
#159858 - 2006-03-28 02:43 PM
Re: Using an array?
|
Stephen Wintle
Seasoned Scripter
Registered: 2001-04-10
Posts: 444
Loc: England
|
Hi, Thanks for replies, works fine!
_________________________
Dont worry because a rival imitates you. As long as they follow in your tracks they cant pass you!
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 583 anonymous users online.
|
|
|