Forum Discussion

almmatt's avatar
almmatt
Contributor
9 years ago

Get current Windows user SID

Hello everyone,   I am looking for a way to get the current Windows user SID during script execution. Part of our regression testing requires that we verify deleting an item within our application ...
  • HKosova's avatar
    9 years ago

    Hi almmatt,

     

    Try this:

     

    function getSID()
    {
      var oWMI = GetObject("winmgmts:");
      var oAccount = oWMI.Get("Win32_UserAccount.Name='" + Sys.UserName + "',Domain='" + Sys.DomainName + "'");
      return oAccount.SID;
    }