APC UPS Data Center & Enterprise Solutions Forum
Schneider, APC support forum to share knowledge about installation and configuration for Data Center and Business Power UPSs, Accessories, Software, Services.
Posted: 2021-06-30 03:03 AM . Last Modified: 2024-03-08 05:00 AM
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-06-30 03:03 AM . Last Modified: 2024-03-08 05:00 AM
Hello,
I try to configure like this in the field "Full path of the command file": ....see attached picture...
Powershell.exe -WindowStyle Hidden -command "C:\Scripts\APCsendEmail.ps1" or only this C:\Scripts\APCsendEmail.ps1
Both do not work. Have anybody an idea for this isuue?
Thanks for help
Frank
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-06-30 03:03 AM . Last Modified: 2024-03-08 04:59 AM
This may be due to restrictions on running unsigned powershell scripts.
To view the current policy:
PS C:\ Get-ExecutionPolicy
To change the setting:
PS C:\ Set-ExecutionPolicy -ExecutionPolicy Unrestricted etc (to view options run help Set-ExecutionPolicy)
Then create a .cmd file to run the script:
Powershell.exe -WindowStyle Hidden c:\
Message was edited by: pcnsqa
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-06-30 03:03 AM . Last Modified: 2024-03-08 05:00 AM
>
Hello,
I try to configure like this in the field "Full path of the command file": ....see attached picture...
Powershell.exe -WindowStyle Hidden -command "C:\Scripts\APCsendEmail.ps1" or only this C:\Scripts\APCsendEmail.ps1
Both do not work. Have anybody an idea for this isuue?
>
You probably need to create a .bat file to launch Powershell with your script as an argument. See example 2 here:
http://nam-en.apc.com/app/answers/detail/a_id/1784
Then give PCNS the path to your .bat file.
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-06-30 03:03 AM . Last Modified: 2024-03-08 05:00 AM
hi frank. i am not sure if that will work.
check out the following knowledgebase articles.
http://nam-en.apc.com/app/answers/detail/a_id/2441/
http://nam-en.apc.com/app/answers/detail/a_id/1784 (this is for XP, 2000, etc) but I think still applies.
hope that helps!
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-06-30 03:03 AM . Last Modified: 2024-03-08 05:00 AM
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-06-30 03:03 AM . Last Modified: 2024-03-08 05:00 AM
Hi,
THX
But it will not help....;-(((
FRank
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-06-30 03:03 AM . Last Modified: 2024-03-08 05:00 AM
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-06-30 03:03 AM . Last Modified: 2024-03-08 05:00 AM
Hi,
I tried also a CMD and BAT file for execution.
Frank
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-06-30 03:03 AM . Last Modified: 2024-03-08 05:00 AM
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-06-30 03:03 AM . Last Modified: 2024-03-08 05:00 AM
Hi,
I tried also a CMD and BAT file for execution.
Here is the ps code: ...
$Emailserver = "exchange.xxxxxxx"
$mail = New-Object System.Net.Mail.MailMessage
$mail.From = APC-PowerChute@xxxxxx
$mail.To.Add("it-hotline@xxxx")
$mail.Subject = "Check the power on: $env:computername"
$mail.Body = "ATTENTION!!!!!!!!!!!!!! Check Power on server $env:computername!!!!"
$smtp = New-Object System.Net.Mail.SmtpClient($Emailserver)
$smtp.Send($mail);
Maybe I need a module?
Frank
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-06-30 03:03 AM . Last Modified: 2024-03-08 04:59 AM
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-06-30 03:03 AM . Last Modified: 2024-03-08 04:59 AM
Hi,
here the solution:
powershell.exe -ExecutionPolicy Unrestricted -NoProfile -NonInteractive -file c:\scripts\APCSendEmail.ps1
Best
Frank
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-06-30 03:03 AM . Last Modified: 2024-03-08 04:59 AM
This may be due to restrictions on running unsigned powershell scripts.
To view the current policy:
PS C:\ Get-ExecutionPolicy
To change the setting:
PS C:\ Set-ExecutionPolicy -ExecutionPolicy Unrestricted etc (to view options run help Set-ExecutionPolicy)
Then create a .cmd file to run the script:
Powershell.exe -WindowStyle Hidden c:\
Message was edited by: pcnsqa
Link copied. Please paste this link to share this article on your social media post.
Create your free account or log in to subscribe to the board - and gain access to more than 10,000+ support articles along with insights from experts and peers.