This topic has been archived. It cannot be replied.
-
工作学习 / 专业技术讨论 / How to pipe DSQUERY to SCHTASKS?I plan to use dsquery to list computer names in an OU and use schtasks to schedule tasks on them. I have both commands working individually:
dsquery computer "OU=xxx,OU=xx,,DC=xx -o rdn
schtasks /create /tn "new task" /tr "\\fileserver\xx.exe" /sc weekly /ru dn\user
/rp password /s computername
How can I pipe the dsquery result to the /s computername in schtasks?
Thanks in advance.
-bump(bump-it);
2007-8-8
{408}
(#3856647@0)
-
Found it!dsquery computer "OU=xxx,OU=xx,,DC=xx -o rdn > clist.txt
for /f %%1 in (clist.txt) do schtasks /create /tn "new task" /tr "\fileserverxx.exe" /sc weekly /ru dnuser /rp password /s %%1
-bump(bump-it);
2007-8-8
{192}
(#3857338@0)