Jump to content

Assign A User Privilege To Log On As Service?


Recommended Posts

Is there a way to use AutoIt to assign a user the right to Log On As A Service? I know how to do that from the Local Users Policy manager, and there are command-line tools that do the job, but is there a way to do the job via AutoIt?

Many thanks for any help.

Link to comment
Share on other sites

Do some of you WMI wizards know how to do this?

(free bump)

(Thanks for the bump!) The only workaround I've figured out so far is to FileInclude Microsoft's ntrights.exe from the Windows resource kit and run it from a command shell like this

$u = @ComputerName & "\" & @UserName
$nte = 0
$nte = FileExists(@TempDir & "\ntrights.exe")
If $nte = 0 Then FileInstall("c:\pathto\ResourceKit\ntrights.exe", @TempDir & "\ntrights.exe", 1)
RunWait(@ComSpec & " /c " &  @TempDir & '\ntrights.exe -u ' & $u & ' +r SeServiceLogonRight', "", @SW_HIDE)
If $nte = 0 Then FileDelete(@TempDir & "\ntrights.exe")

This works, but I tend to doubt it's legal to distribute ntrights.exe If there's an all-AutoIt way to do this, I'd be very glad to hear about it!

Link to comment
Share on other sites

  • 2 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...