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-26 01:04 AM . Last Modified: 2024-03-19 02:35 AM
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-06-26 01:04 AM . Last Modified: 2024-03-19 02:35 AM
Hi,
I want to use a Powershell script to send customized email from our APC Smart-UPS when different actions (events) occurs, lets say when there is an current outage. When the script is run from within Powershell, it works as it should be. However, when the same script is executed from the UPS, it does not work.
The problem has to do with Credentials. Unsafe credential script 1) works perfectly. But getting credential as with script 2) does not work when executed from UPS. The whole setup of Credentials in windows, is good because the script successfull send email when run from within PowerShell.
The scripts runs from APC Smart-UPS PowerChute Business Edition connected to a Windows Server 2012 R2. The scripts are located on the server itself. The Powershell script is run from the UPS by using a batch file.
The .bat script
PowerShell.exe -ExecutionPolicy Unrestricted -noProfile -nonInteractive -file c:\xxxxx\PS\scripts\XXXXXSelfTestPast.ps1. Also when this batch file is run from the command prompt, everything works.
1) Create credentials. This WORKS
$username = "aaaaa@bbbbbbbb"
$password = "xxxxxxxxxx"
$myPwd = ConvertTo-SecureString -string $password -AsPlainText -Force
$cred = New-Object System.Management.Automation.PSCredential -argumentlist $username, $myPwd
........ rest code
2) Create credentials. This does NOT work.
$cred=Get-StoredCredential -target XXXXXX
........ rest code
Mario
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-06-26 01:04 AM . Last Modified: 2024-03-19 02:35 AM
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-06-26 01:04 AM . Last Modified: 2024-03-19 02:35 AM
Sorry was for another Forum.
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-26 01:04 AM . Last Modified: 2024-03-19 02:35 AM
Hi,
Please review this thread. https://forums.apc.com/spaces/7/ups-management-devices-powerchute-software/forums/general/98078/runn...
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-06-26 01:04 AM . Last Modified: 2024-03-19 02:35 AM
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-06-26 01:04 AM . Last Modified: 2024-03-19 02:35 AM
Hi,
Ok Thanks.
Now I know why the script is not working.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-06-26 01:04 AM . Last Modified: 2024-03-19 02:35 AM
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-06-26 01:04 AM . Last Modified: 2024-03-19 02:35 AM
Now I know what the problem is. See this link:
Mario
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-06-26 01:04 AM . Last Modified: 2024-03-19 02:35 AM
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-06-26 01:04 AM . Last Modified: 2024-03-19 02:35 AM
Sorry was for another Forum.
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.