Failed to Login as user

This plugin monitors local admin group for changes and alerts admins when changes have been made.
Post Reply
Jaym
Posts: 1
Joined: Thu Feb 11, 2021 5:09 am

Failed to Login as user

Post by Jaym »

I am having an issue with the script running on Computers, looking at the command, the script is saying failed to login as user. Error : the user name or password is incorrect
Loginasuser.PNG
Loginasuser.PNG (113.87 KiB) Viewed 274 times
If i change the script to run as local instead of run as admin i get the below error
Run as local.PNG
Run as local.PNG (32.57 KiB) Viewed 274 times
So far running as admin 3 computers have shown out of 60 and have successfully run, the others are failing.

Can anyone let me know why its failing on the rest?

User avatar
Cubert
Posts: 1697
Joined: Tue Dec 29, 2015 7:57 pm
Contact:

Re: Failed to Login as user

Post by Cubert »

Running as the local user does not have permissions needed to query the local administrators group via POSH.

See if you can execute this as the agent and get a return that is expected.

Code: Select all

 net localgroup administrators | where {$_ -AND $_ -notmatch "command completed successfully"} |  select -skip 4  -ErrorAction SilentlyContinue

User avatar
Cubert
Posts: 1697
Joined: Tue Dec 29, 2015 7:57 pm
Contact:

Re: Failed to Login as user

Post by Cubert »

Should look a little something like this,

Capture.PNG
Capture.PNG (12.19 KiB) Viewed 151 times

Execute this inside of a command prompt inside the control center on an agent and see what you get. If it works then you need to make sure the script is set to use either "shell execute as admin" or "Shell execute Enhanced"

Post Reply