Page 1 of 1 1
Topic Options
#43533 - 2003-07-30 03:44 AM Quick way to get all workstation names?
rbardo Offline
Fresh Scripter

Registered: 2003-07-24
Posts: 47
Loc: USA
Hey guys,

I was wondering if there is a quick way to get all the workstation names on the domain? I want to pass the name as a variable into the task scheduler udf so that I can automate setting a task on every machine with the same settings..

Thanks.

[ 30. July 2003, 03:45: Message edited by: rbardo ]
_________________________
Ekadanta Mahakaya Surya koti samaprabha Nirbighnam kurume deva sarbakaryeshu sarbada

Top
#43534 - 2003-07-30 03:49 AM Re: Quick way to get all workstation names?
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Topic: COMNetView() - Enumerate all computers in your domain
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#43535 - 2003-07-30 04:13 AM Re: Quick way to get all workstation names?
rbardo Offline
Fresh Scripter

Registered: 2003-07-24
Posts: 47
Loc: USA
Gracias!

[Big Grin]
_________________________
Ekadanta Mahakaya Surya koti samaprabha Nirbighnam kurume deva sarbakaryeshu sarbada

Top
#43536 - 2003-07-30 04:24 AM Re: Quick way to get all workstation names?
rbardo Offline
Fresh Scripter

Registered: 2003-07-24
Posts: 47
Loc: USA
HEy Lligetfa,

So is $objComputername.Name the variable I want to pass to the task scheduler udf?

also, how do I make so it gets one name and passes it off to scheduler then next name and pass and so on...

sounds like an if loop to me but Im a newbie so I suck.. )-:

[Wink]

Thanks.
_________________________
Ekadanta Mahakaya Surya koti samaprabha Nirbighnam kurume deva sarbakaryeshu sarbada

Top
#43537 - 2003-07-30 04:27 AM Re: Quick way to get all workstation names?
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4402
Loc: New Jersey
For parsing arrays, read about the "For Each" command.
code:
$Array = list,of,things

For Each $Element in $Array
? "Current element is " $Element
Next

Glenn

PS - the last paragraph in the tsControl UDF manual states:
"More complex tasks can be built.. For example, the tsGetEvent function can be used to read all event information into the arrays. A call to tsSetCredentials to define the password, followed by repeated calles to tsActivateEvent - all controlled by a For Each loop - could copy that event to all of the servers defined in an array, quickly replicating a tast from one test server to dozens of production servers!"

Jens' ScheduleTask UDF is ideal to push this kind of task out - sweet and direct. My tsControl library is well suited for applications that need to enumerate, read, modify, and copy tasks in addition to creating them. tsControl also allows multiple triggers per event, so you could schedule a task "at startup", "at logon", and "every 6 hours between 6am and 6pm"

[ 30. July 2003, 04:39: Message edited by: Glenn Barnas ]
_________________________
Actually I am a Rocket Scientist! \:D

Top
#43538 - 2003-07-30 04:28 AM Re: Quick way to get all workstation names?
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
The vars inside the UDF have a local scope and are not to be used outside of the UDF. In the UDF header there is an explanation of how it works.
quote:
;RETURNS An array of strings representing all the computers in the domain
;EXAMPLE
for each $computer in COMNetView()
? ''+$computer
next



[ 30. July 2003, 04:32: Message edited by: LLigetfa ]
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#43539 - 2003-07-30 02:38 PM Re: Quick way to get all workstation names?
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
COMNetView() only returns computers that are registered in the domain, thus Windows 9x computer will not be listed. If the list of computers must include Windows 9x computers, then either NetView() or NetView2() need to be used. This is mentioned in the COMNetView()header.

See alos the FAQ Forum under How to use UDFs
_________________________
There are two types of vessels, submarines and targets.

Top
#43540 - 2003-07-30 06:45 PM Re: Quick way to get all workstation names?
rbardo Offline
Fresh Scripter

Registered: 2003-07-24
Posts: 47
Loc: USA
HEy Glenn,

Where and how (example only) do I encorporate
code:
  $Array = list,of,things 
For Each $Element in $Array
? "Current element is " $ElementNext

into an "array" to be used with your tscontrol()UDF. I am using it now and can hit one machine at a time and it works sweetness..

Thanks,

Rob - rbardo@VENDINGDATA.COM
[Confused]

[ 30. July 2003, 19:56: Message edited by: rbardo ]
_________________________
Ekadanta Mahakaya Surya koti samaprabha Nirbighnam kurume deva sarbakaryeshu sarbada

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 1452 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.059 seconds in which 0.027 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org