Applications Systems
User credentials cannot be used for local connections error on Server Clock Drift template of an agent node
This article discusses about a User credentials cannot be used for local connections error in Server Clock Drift (PowerShell) template when tested on a Windows agent node
First published date
Last published date
Overview
When assigning a Server Clock Drift (PowerShell) template on a Windows agent node in SAM, you may get an error message upon testing the script while the template is set to Agent Preferred Polling Method:
User credentials cannot be used for local connections
Product section
Cause
This issue occurs because the Server Clock Drift (PowerShell) template does not run properly on agent nodes if the default polling method is set to Agent. The following command works for Agentless polling but fails for agent polling because credentials can't be used for the local connection.
Resolution
Workaround
Use a simpler PowerShell script to monitor clock drift
# Scripts are not supported under any SolarWinds support program or service.
# Scripts are provided AS IS without warranty of any kind. SolarWinds further
# disclaims all warranties including, without limitation, any implied warranties
# of merchantability or of fitness for a particular purpose. The risk arising
# out of the use or performance of the scripts and documentation stays with you.
# In no event shall SolarWinds or anyone else involved in the creation,
# production, or delivery of the scripts be liable for any damages whatsoever
# (including, without limitation, damages for loss of business profits, business
# interruption, loss of business information, or other pecuniary loss) arising
# out of the use of or inability to use the scripts or documentation.
$ntpServer = $args.get(0);
if (!$ntpServer)
{
Write-Host "Message: Can't find ""ntpServer"" argument. Check documentation.";
exit 1;
}
$ntpQuery = Invoke-Expression "w32tm /monitor /computers:$ntpServer" | Out-String;
$findSkew = [regex]"(?:NTP\: )(?<Value>[^s]+)";
if ($ntpQuery -match $findSkew)
{
$ntpToLocalSkew = [double]::Parse($Matches['Value'])
$roundedSkew = [math]::Round($ntpToLocalSkew, 2)
Write-Host "Message: Clock drift: ${roundedSkew}s"
Write-Host "Statistic: $([math]::Abs($roundedSkew))"
exit 0
}
else
{
Write-Host "Message: Unable to query NTP server $ntpServer."
exit 1
}