Change text written to host for Get-Credential

Hi all,

So I have a couple of scripts where I am using a Get-Credential in them. What I’m looking to do is to change the text that is written to the PowerShell window when it occurs in the code. The prompt itself and everything else about it is working fine, I’m just looking to clean up the output slightly. When my function gets to the $cred = Get-credential the host window outputs:

 

cmdlet Get-Credential at command pipeline position 1
Supply values for the following parameters:
Credential

 

Ideally I would like it to instead read something like

Please enter credentials for the SQL Server

 

I know that normally you can do a read-host for something like this but being that get-credential is a specialized cmdlet I didn’t know how to go about that.

 

Thanks!

Jarrod

Well then, now I feel foolish. So some further research there is a -message parameter on the Get-Credentials so if you do something like:

 

Get-Credential -Message “SQL Server Creds”

 

It not only removes all of the host text but alters the messaging on the prompt box to the messaging you entered.

Thanks,

Jarrod