title: Using powershell, how do I check for “Log on as service” to an account for remote server?
body: <p>I want to know whether a specific user with details like username, password, ip, hostname;
  Using powershell script, how do I check for “Log on as service” to an account for remote server ?</p>
  <pre><code>function Get-UserRightsGrantedToAccount([String]$UserName, [String]$Password, [String]$ComputerAddress, [String]$HostName) {
        $Credentials = New-Object System.Management.Automation.PSCredential ($UserName, (ConvertTo-SecureString $Password -AsPlainText -Force))
     // code to check User Right &quot;SeServiceLogonRight&quot;
  }
  </code></pre>