Get current Windows user SID
SOLVED- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-10-2015
08:00 AM
12-10-2015
08:00 AM
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 moves it to the Recycle Bin. Online research has uncovered that the path to the recycle bin is C:\$Recycle.bin\<Windows User SID>.
So, I could use some help writing a JScript script to get this information. Has anyone done this before?
PS: You can see your SID from the command prompt using this:
whoami /user
Solved! Go to Solution.
2 REPLIES 2
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-10-2015
08:20 AM
12-10-2015
08:20 AM
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; }
Helen Kosova
SmartBear Documentation Team Lead
________________________
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-10-2015
08:25 AM
12-10-2015
08:25 AM
Thank you very much! That is exactly what I needed!
