Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ::This Script is to send domain user/s a message
- ::Requires elevation and drive mappings
- ::http://pastebin.com/6bawWDUs
- @Echo off
- SET count=0
- Set xdate=%date:~-4,4%%date:~-7,2%%date:~-10,2%
- Set return=^& echo.
- NET USE X: %xdrive% /PERSISTENT:No
- set location=X:\Path\To\Destination
- cd /d %location%
- @mkdir %location%\Logs\Messaging\%xdate%
- set log=%location%\Logs\Messaging\%xdate%\history.txt
- CHOICE /C:YNQ /N /D Q /T 35 /m "Message All User? [Y]yes or [N]No"
- goto s_routine_%ERRORLEVEL%
- :s_routine_1
- ::Message All Users
- SET /P query_Msg=What do you want to say?
- ::For Each Domain Computer
- FOR /D %%p IN ('%location%\Logs\ComputerInventory') DO (
- msg * /SERVER:%%p "%query_Msg% ~From %xusername%"
- Set /a count+=1 )
- msg %xusername% "Message Sent:%query_Msg%"
- Pause
- goto s_routine_3
- :s_routine_2
- ::Message an User
- net user /domain
- SET /P query_User=What Username do you want to send to?
- SET /P query_Msg=What do you want to say?
- ::For Each Domain Computer Message the Specific User
- FOR /D %%p IN ('%location%\Logs\ComputerInventory') DO (
- msg %query_User% /SERVER:%%p "%query_Msg% ~From %xusername%"
- Set /a count+=1 )
- msg %xusername% "Message Sent:%query_Msg% to %query_User%"
- :s_routine_3
- (echo %time%: %xusername%@%computername% Sent %query_Msg% to %query_User% %count%%return%) >> %log%
- Exit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement