question

Maxer avatar image
Maxer asked

SQL 08 Agent PowerShell job fails: "Logon failure: unknown user name or bad password"

I get this error:

"reason: Error authenticating proxy domain\user, system error: Logon failure: unknown user name or bad password."

This happens when I start my SQL 2008 Agent job that I created.

The job is owned by my domain account, I have full sysadmin rights on the SQL 08 install.

This is running on my local machine (for dev/testing).

There is 1 step which runs a PowerShell script:

       function Remove-OldFiles($folder, $logFile, $filter, $age)
    {
        Get-ChildItem $folder* -Include $filter -Exclude $logFile |
            ? { $_.LastWriteTime -le (Get-Date).AddMinutes(-$age) } |Remove-Item -verbose
    }

 Remove-OldFiles '\\server-name\c$\PSHtest\' 'DeleteLog.txt' *.txt, *.xml 3

It runs as a proxy account.

This proxy account is allowed to use the PowerShell subsystem only and as my domain account is part of sysadmin I have not assigned it to the proxy account principals list.

The proxy account uses a credential that is just my own domain account.

If I use the SQL Agent account to run the script the job does NOT fail, but the script itself cannot execute and returns the error:

"The error information returned by PowerShell is: 'An object at the specified path \servername\c$\PSHtest does not exist. "

Which is why I assigned a proxy to run, a proxy that has access to that part of the network for testing.

Suggestions on how I can correct this?

I've seen pages that say this error may be due to the service account not being enabled for delegation. Could that be the cause of this problem?

I am not familiar with the details of delegation so if that is the reason behind it a brief explanation would be greatly appreciated.

Thank you!

sql-server-2008sql-agent
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Blackhawk-17 avatar image
Blackhawk-17 answered

Based on the URL you are attempting to access an administrative share on the server.

Try creating a non-administrative share and assign it permissions for your SQL Agent ID and/or Proxy account then try again.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Maxer avatar image
Maxer answered

The URL was part of the issue and it turns out that I had the SA account disabled and it appears that needs to be enabled for mixed auth to work. After doing that it seemed to work properly.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.