Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.
May 11, 2004
Using the DSQUERY command, I have scripted NetSendOU.bat to net send a message to all users in a given OU.
The syntax for using NetSendOU.bat is:
NetSendOU OU Message
Where OU is the organizational unit, like "OU=West Coast,DC=JSIINC,DC=COM", and Message is the message text, like "Hello world".
NetSendOU.bat contains:
@echo offif {%2}=={} @echo Syntax: NetSendOU OU "Message"&exit /b 1setlocalset query=dsquery user %1 -o samidset message=%2for /f %%u in ('%query%') do ( net send "%%u" %message%)endlocalexit /b 0
You May Also Like