Solved

A script batch to send a Message to WKS in the LAN

Posted on 2014-10-27
8
459 Views
Last Modified: 2014-10-29
i need a batch script to send an Alert message to One or many computers in the LAN

the script should take some variables that the user will key in which are:
The Number of WKS to send the message (Var  1)
The Names of the WKS to send the messages (Var2)
The Message to be sent (Var "3)

and the script will use the command msg to send var 3 to WKS in VAr 2

I hope i made this clear . the script should be enough User friendly that why I see a dialogue to collect the variables

Thx
0
Comment
Question by:gazambey
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 25

Expert Comment

by:NVIT
ID: 40407161
What is Number of WKS for?

How about this?
set /p NumWKS=Number of WKS?
set /p NameWKS=Name of WKS?
set /p Msg=Message?
msg %NameWKS% %Msg%

Open in new window

0
 
LVL 29

Accepted Solution

by:
becraig earned 500 total points
ID: 40407164
powershell version:
If you want your script to run interactively you could go for comma separated values in your computername string. For example:
$message = read-host -prompt "type your message here"
$computername = Read-Host -Prompt "type a computername or multiple separated by comma"
$session = "*"
foreach ($computer in ($computername -split ',')) {
msg $session /server:$computer $message
}

Open in new window


If you want to have a parameterized script you could do something like this, allowing you to call this script with 1 or more computer names:
param (
[string]$Message,
[string[]]$ComputerName
[string]$Session = '*'
)
foreach ($Computer in $ComputerName) {
msg $session /server:$computer $message
}

Open in new window


Taken from:
http://powershell.com/cs/forums/p/13545/25028.aspx
0
 
LVL 25

Expert Comment

by:Lionel MM
ID: 40410506
What version of Windows do you want this to work on or do you have computers other than just Windows?
0
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 

Author Comment

by:gazambey
ID: 40410659
hello all my machines are Windows

Rgds
0
 

Author Comment

by:gazambey
ID: 40410660
Most of them are Windows 7
0
 
LVL 29

Expert Comment

by:becraig
ID: 40410964
Do neither of the two script options I provided above work for you ?
0
 

Author Comment

by:gazambey
ID: 40411077
Yes the scripts are working fine . I choose the Interactive one . The Only thing for certains Machines there is one Registry key that have to be changed otherwise there will be an error
0
 
LVL 29

Expert Comment

by:becraig
ID: 40411102
Is that something you need help with, or do you pretty much have a handle on it ?
0

Featured Post

Ready to get started with anonymous questions?

It's easy! Check out this step-by-step guide for asking an anonymous question on Experts Exchange.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

YESTERDAY YESTERDAY.BAT is inspired by a previous article I wrote entitled: TOMORROW.BAT (http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/MS_DOS/A_4196-Advanced-Batch-File-Programming-TOMORROW-BAT.html). The crux of this batch f…
Introduction: Recently, I got a requirement to zip all files individually with batch file script in Windows OS. I don't know much about scripting, but I searched Google and found a lot of examples and websites to complete my task. Finally, I was ab…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

630 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question