KS-Soft. Network Management Solutions
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister    ProfileProfile    Log inLog in 

Need To Get Server Name In PowerShell

 
Post new topic   Reply to topic    KS-Soft Forum Index -> Configuration, Maintenance, Troubleshooting
View previous topic :: View next topic  
Author Message
jjohnso7



Joined: 24 Aug 2016
Posts: 5

PostPosted: Fri Sep 09, 2016 3:59 pm    Post subject: Need To Get Server Name In PowerShell Reply with quote

Host Monitor knows what the server name is. Is there any way I can get the ServerName into a PowerShell Script?
Back to top
View user's profile Send private message
KS-Soft



Joined: 03 Apr 2002
Posts: 12792
Location: USA

PostPosted: Sat Sep 10, 2016 2:32 pm    Post subject: Reply with quote

What exactly "server" do you have in mind?
Server where HostMonitor is running?
Server where some Remote Monitoring Agent running?
Server checked by some test method?
some other server?

How exactly your script relates to HostMonitor?
Script started by "Execute external program" action assigned to some test item?

Regards
Alex
Back to top
View user's profile Send private message Visit poster's website
jjohnso7



Joined: 24 Aug 2016
Posts: 5

PostPosted: Mon Sep 12, 2016 9:02 am    Post subject: Need To Get Server Name In PowerShell Reply with quote

HostMonitor periodically runs a test on a list of servers. The test calls PowerShell via Shell Script. Maybe Host Monitor could pass the Server Being Tested name via an input parameter.

Last edited by jjohnso7 on Mon Sep 12, 2016 9:08 am; edited 1 time in total
Back to top
View user's profile Send private message
KS-Soft Europe



Joined: 16 May 2006
Posts: 2832

PostPosted: Mon Sep 12, 2016 9:07 am    Post subject: Reply with quote

Sure, you may specify parameters (e.g. Server name) in "Params" field,
then you may use this value in the script.
E.g.
"Params" field:
22 MyServer1
Script:
$statusOk = "ScriptRes:Ok:"
$val = $args[1]
echo $statusOk$val

If parameter contains space symbol, just put it in single quote marks.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
jjohnso7



Joined: 24 Aug 2016
Posts: 5

PostPosted: Mon Sep 12, 2016 1:57 pm    Post subject: Reply with quote

If I pass a parameter to PowerShell containing a file path, it goes in a field <Params>. Can I use that variable name in <Params> to pass info to an alert that sends an email with an attachment of the same file name? Like this: Attach File <Params>
Back to top
View user's profile Send private message
KS-Soft Europe



Joined: 16 May 2006
Posts: 2832

PostPosted: Mon Sep 12, 2016 2:44 pm    Post subject: Reply with quote

You may set file path from "Params" field as Reply, then use %Reply% variable in "Attach file" field of Send e-mail (SMTP) action.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    KS-Soft Forum Index -> Configuration, Maintenance, Troubleshooting All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group

KS-Soft Forum Index