How to pass credentials in powershell

Developer3
Tera Expert

I am working on a Servicenow Orchestration use case. In this, i have to connect to Teams session using credentials (Connect-MicrosoftTeams -Credential $credentials).

I created a custom PowerShell activity for this use case. Please let me know how to pass the credentials in the PowerShell activity

2 REPLIES 2

Anil Shewale
Mega Guru

Hi

PowerShell selects a "Windows" type Credential from your Credential (discovery_credentials) table in ServiceNow (or runs as your MID Servers service account) and passes the credential into the script as the $cred variable. You can use the $cred in your script like this:

Get-WmiObject -Credential $cred -Class "Win32_Service"

 

refer the following thread it similar to your question it might help you.

https://community.servicenow.com/community?id=community_question&sys_id=0fde43a1dbdcdbc01dcaf3231f96...

 

If it help mark helpful or correct 

Thanks and regards

Anil

Hemant Goldar
Mega Sage
Mega Sage

Hi,

 

In addition to @Anil Shewale please go through the below link that might help you.

https://docs.servicenow.com/bundle/orlando-servicenow-platform/page/product/orchestration/task/set-u...

https://hi.service-now.com/kb_view.do?sysparm_article=KB0697306

Hope this helps.

 

Regards,

Hemant