→ Celebrate SysAdmin Day 2024 with Lansweeper Enter our Giveaway here

Showing results for 
Show  only  | Search instead for 
Did you mean: 
Engaged Sweeper III
I at first did this action becuase i was bored and wanted to have fun with people but i have started getting real use from it as of late and figured i would share it.

pre reqs

you will ned to place the following files in your custom actions folder

Nircmd.exe (I renamed it Speak in my batch)(NOTE nircmd is an AMAZING tool for sys admins)

custom action code:(NOTE this could use some cleaning up I used it from a different CA)
cmd.exe /K "{actionpath}speak.bat {actionpath} {ipaddress} {actionpath} {actionpath} {ipaddress}"


@echo off

%1psexec.exe \\%2 taskkill /F /IM speak.exe
XCOPY "%3speak.exe" \\%2\c$\windows\system32\ /Y

set INPUT=
WMIC /Node:%2 ComputerSystem Get UserName
set /P INPUT=Type Message here: %INPUT%
%1psexec.exe \\%2 -i %3speak.exe speak text %INPUT%
cmd DEL c:\Windows\System32\speak.exe"

there are a few things happening here first we are checking to make sure the speak.exe process is not running on the remote machine if it isnt it will just say that there is no process found if it is it will kill it next we will copy the file over. now i know this is very sloppy but its ok its a batch file. next it will check to see who is logged in to the computer so if you want to talked to them directly you know who it is. Next you can type in what you want to say. the second to last command uses the -i command which executes it to whoever has an active desktop on that computer AKA the current user that is logged in. next it will delete the original file. let me know what you think im sure there is ways to make this much better. thanks
Engaged Sweeper
Ops, My net antivirus Trend Micro marks NirCmd as a virus, when I download:

Virus was detected in the content (virus_detected)
Content contained "PUS:App/NirCmd-Gen" virus. Details: Virus: PUS:App/NirCmd-Gen; File: nircmd.zip; Sub File: \nircmd.exe; Vendor: Sophos, Plc.; Engine error code: 0x20040203; Engine version: 3.65.2; Pattern version: 5.27.11289627.158404346; Pattern date: 2016/06/01 03:49:00

Figure out when I launch the batch...

Any solution?
Engaged Sweeper III
this is because DOS sucks and doesnt like spaces so if it is a sentence with spaces it will need "" around it... guess i should have mentioned that sorry...
Engaged Sweeper II
I could not get this to work until I modified it a little;

@echo off
%1psexec.exe \\%2 taskkill /F /IM nircmd.exe
XCOPY "%3nircmd\nircmd.exe" \\%2\c$\windows\system32\ /Y

WMIC /node:%2 ComputerSystem Get UserName
set /P INPUT=Type Message Here: %input%
%1psexec.exe \\%2 -i nircmd.exe speak text %input%
%1psexec.exe \\%2 cmd /c DEL c:\windows\system32\nircmd.exe

Now it will run, but seems to work intermittently. Haven't been able to figure out why yet.
Tested on XPx86 and Win7x64 so far...