I am running Test-DbaNetworkLatency -SqlCredential sa
in powershell
to measure sql server network latency. It prompts input password each time I run the command. I am planning to schedule a cronjob on my server to run this command regularly so I am looking for a way to avoid typing password each time. Can anyone tell me how I can achieve that in powershell?
You will need to create a credential object for the function.
The function info shows Windows and SQL Authentication supported. Accepts credential objects (Get-Credential)
$password = ConvertTo-SecureString "Password" -AsPlainText -Force
$creds = New-Object System.Management.Automation.PSCredential ("sa", $password)
Test-DbaNetworkLatency -SqlCredential $creds