JSI Tip 8026. How can I 'net send' to all users in an Organizational Unit (OU)?

Jerold Schulman

May 11, 2004

1 Min Read
ITPro Today logo in a gray background | ITPro Today

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



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.

You May Also Like