How to push message to all PC ?
Hello
Please anyone guide me how to push message to all PC (Pc join domain) . I want when our system has problem then will push message to all pc to all user quick know .instead of when logon or send all email
Best Regards,
Thanks
Hello, there is a feature built in to windows that will do this! The msg command on windows 10 or net send on windows 7 or older will accomplish this. That being said its probably not as feature rich as you are going to want it!
Format of the command is
MSG username /Server:Machinename "The Message you Want to Send"
It presents a couple of issues for you as an administrator, including the fact that you have to know the list of machines on your network, have access to them via the MSG command (Basic Microsoft networking firewall access has to be enable at the domain level).
The list of machines can easily be gotten if you have Powershell AD module loaded via
(get-adcomputer -filter *).name
If you don't have the Powershell Module you can use ADSI to enumerate your domain members via a searcher -
$Search = [adsisearcher]"(&(objectCategory=Computer))"
($search.findall()).properties.name > Computers.txt
Edit the list to remove out unwanted machines, DC's etc
The following code will enumerate the active logged on user
((qwinsta /server:$ServerName | foreach { (($_.trim() -replace "\s+",","))} | ConvertFrom-Csv)|where {$_.state -like "*ACTIVE*"}).username
We could take this code from the TechNet Community https://gallery.technet.microsoft.com/scriptcenter/Ping-Multiple-Computers-7d13a3aa
And quickly modify it up so that if it pings the machine it sends the message
Its not pretty and needs error handling and some fine tuning, possibly more logic as you require etc but
$ServerName = Get-Content "c:\Temp\Computers.txt"
foreach ($Server in $ServerName) {
if (test-Connection -ComputerName $Server -Count 2 -Quiet ) {
$Username=((qwinsta /server:$Server | foreach { (($_.trim() -replace "\s+",","))} | ConvertFrom-Csv)|where {$_.state -like "*ACTIVE*"}).username
msg $username /Server:$Server "This is a system Broadcast"
} else
{"$Server not pinging"
}
}Should broadcast to all the machines active logged on users from a Windows 10 computer