Flow Designer: Getting Generic Windows Credential in PowerShell Action

AWorley
Tera Contributor

Hello, 
I have a Flow and subsequent script action that is executing a task on a isolated Database environment (all ports are closed except for a specific server that this script executes on). 

In our mid server we have stored the credentials for this Database in the Generic Credentials section of Windows Credentials. 
PowerShell Script: 

 

 

 

# Retrieve the stored credentials
$credential = Get-StoredCredential -Target "Store_DB_QA" -AsCredentialObject
Write-Output "Cred: $credential"
# Check if credentials were found
if ($credential) {
    $DBpswd = $credential.Password
} else {
    Write-Output "Database Credentials not found."
}
$currentHost = [System.Net.Dns]::GetHostByName($env:computerName).HostName
write-output "Environment: $envir"
write-output "Database Password: $DBpswd"  
write-output "Database Username: $DBUser"
write-output "TimeZone: $TimeZone"
write-output "merchID: $SCAMerchID"
Write-Output "Current Computer: $($currentHost)"  

 

 

 

 
Script Output (censored proprietary values but they are showing correct)


Cred:
Database Credentials not found.
Environment: CORRECT ENVIRONMENT TARGET (Not Relevant to issue)
Database Password:
Database Username: Store_DB_QA
TimeZone: EST
merchID: ###################
Current Computer: CORRECT MID SERVER


As you can see ServiceNow does not see the credential, however if I log into the server and execute the same command manually, it returns true. Any advice? 

AWorley_0-1711731767732.png

 




0 REPLIES 0