Werbung: SecurityConsole.de verwaltet Ihre Computer mit Security Essentails aus der Cloud!
30 Tage kostenfrei testen und 20% Rabatt für Ihre Bestellung mit Promocode: WBF2685582
(Promocode gültig bis 31.12.2011)

Group:  English: Windows Server » microsoft.public.windows.server.scripting
Thread: Script help needed!!

HTVi
TV Discussion Newsgroups

Script help needed!!
VR <hairang[ at ]gmail.com> 5/17/2007 12:56:40 PM
Hi,

I need to create a batch file to check a list of computers which is in
Active directory or not.

I can query this by using simple dsquery computer command.

but i need to write a script which will take the system name from my
notepad(using for each %1 in test.txt)

I need the output in the format hostname firstcolumn and Availability
(yes/no) in the next column.

Pls. some one help for this

Thanks
HAI

Re: Script help needed!!
"Jeremy" <jeremy[ at ]discussions.microsoft.com> 5/17/2007 9:25:45 PM
Well here is the loop:

FOR /F "usebackq delims=" %%a in (`dsquery computer -Name %1`) do (
SET FOUND=YES
IF [%%a] == [] SET FOUND=NO
ECHO %1,%FOUND%
)

I haven't tested this, will do when I get to work
"VR" <hairang[ at ]gmail.com> wrote in message
news:1179406600.351022.271450[ at ]n59g2000hsh.googlegroups.com...
[Quoted Text]
> Hi,
>
> I need to create a batch file to check a list of computers which is in
> Active directory or not.
>
> I can query this by using simple dsquery computer command.
>
> but i need to write a script which will take the system name from my
> notepad(using for each %1 in test.txt)
>
> I need the output in the format hostname firstcolumn and Availability
> (yes/no) in the next column.
>
> Pls. some one help for this
>
> Thanks
> HAI
>

RE: Script help needed!!
Jeremy 5/17/2007 11:12:00 PM
This script will loop through a file called computers.txt with the computer
name of each computer you want to check, one per line. Watch the line
wrapping though.

-->8
[ at ]ECHO OFF
FOR /F %%b in (computers.txt) do call :FindComp %%b
GOTO END


:FindComp
SET FOUND=NO
FOR /F "usebackq delims=" %%a in (`dsquery computer -Name %1`) do (
IF NOT [%%a] == [] SET FOUND=YES
)
ECHO %1,%FOUND%
Exit /b

:END
-->8


"VR" wrote:

[Quoted Text]
> Hi,
>
> I need to create a batch file to check a list of computers which is in
> Active directory or not.
>
> I can query this by using simple dsquery computer command.
>
> but i need to write a script which will take the system name from my
> notepad(using for each %1 in test.txt)
>
> I need the output in the format hostname firstcolumn and Availability
> (yes/no) in the next column.
>
> Pls. some one help for this
>
> Thanks
> HAI
>
>
Re: Script help needed!!
VR <hairang[ at ]gmail.com> 5/18/2007 7:31:26 AM
On May 18, 4:12 am, Jeremy <Jer...[ at ]discussions.microsoft.com> wrote:
[Quoted Text]
> This script will loop through a file called computers.txt with the computer
> name of each computer you want to check, one per line. Watch the line
> wrapping though.
>
> -->8
> [ at ]ECHO OFF
> FOR /F %%b in (computers.txt) do call :FindComp %%b
> GOTO END
>
> :FindComp
> SET FOUND=NO
> FOR /F "usebackq delims=" %%a in (`dsquery computer -Name %1`) do (
> IF NOT [%%a] == [] SET FOUND=YES
> )
> ECHO %1,%FOUND%
> Exit /b
>
> :END
> -->8
>
>
>
> "VR" wrote:
> > Hi,
>
> > I need to create a batch file to check a list of computers which is in
> > Active directory or not.
>
> > I can query this by using simple dsquery computer command.
>
> > but i need to write a script which will take the system name from my
> > notepad(using for each %1 in test.txt)
>
> > I need the output in the format hostname firstcolumn and Availability
> > (yes/no) in the next column.
>
> > Pls. some one help for this
>
> > Thanks
> > HAI- Hide quoted text -
>
> - Show quoted text -

Hi Jeremy,

Really thanks a Million for this yar.

Ur script is working & solved my need

Once again Thanks man

RANG

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net
Suche nach Orten, Städten, Postleitzahlen, Vorwahlen, Kfz-Kennzeichen