
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-03-2014 02:06 PM
Can someone please enlighten me on how to pass credentials to a custom PowerShell probe?
It seems like I can create a PowerShell probe and add the above line to pass credentials at run time from the Credentials table.
I looked at the Windows - MSSQL Probe (sqlinfo.ps1) and the skeleton of my PS probe is below.
$job=Start-Job -ScriptBlock {
……
……
} —Credential $cred
Wait-Job $job
Receive-Job $job
Is this all I need to add to pass credentials to my ScriptBlock? Does Discovery iterate through all active Windows credentials to find a match?
Expert guidance appreciated, thanks,
Subash Biswas
Solved! Go to Solution.
- Labels:
-
Service Mapping
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-03-2014 02:11 PM
Subash,
You are correct we do go through all credentials till we find a match the first time. Once we are able to authenticate we set an affinity to the IP and successful credential so the 2nd, 3rd, 10th time we discover the target we know the right one to use. If at any time it fails again we try others hoping to find a match..
From the Powershell probe:
The Powershell script is provided as the value of a parameter with name ending in ".ps1". Two variables are available to the script:
$computer - the computer pointed to as the "source" for this probe
$cred - a Powershell credential using a user/password from the Credentials table that successfully logs into $computer.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-03-2014 02:11 PM
Subash,
You are correct we do go through all credentials till we find a match the first time. Once we are able to authenticate we set an affinity to the IP and successful credential so the 2nd, 3rd, 10th time we discover the target we know the right one to use. If at any time it fails again we try others hoping to find a match..
From the Powershell probe:
The Powershell script is provided as the value of a parameter with name ending in ".ps1". Two variables are available to the script:
$computer - the computer pointed to as the "source" for this probe
$cred - a Powershell credential using a user/password from the Credentials table that successfully logs into $computer.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-03-2014 02:15 PM
Thanks Doug!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-03-2014 02:29 PM
Side comment: If you're using Runbook to execute specific commands to do stuff (NOT discovery), you can specify a 'credential tag' in the work flow activity that will direct you to a specific credential (or list of credentials if you have the same tag specified for multiple credentials).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-20-2015 04:14 AM
There is a Ask the Expert video available dealing with powershell and credentials questions
Ask the Expert | Workflow: Credentials, Run Powershell and Run SSH Activities - YouTube
Assigning Credentials to Orchestration Activities - ServiceNow Wiki