Advertisement
easternnl

Read ShellFolders of another user on the system (PowerShell)

May 6th, 2015
661
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Read ShellFolders of another user on the system
  2.  
  3. # $sid = (gwmi win32_useraccount | where {$_.name -eq "appv" }).sid
  4. # (The above method is not the way to go because it is querying the complete active directory which is time & resource consuming)
  5.  
  6. $user= New-Object System.Security.Principal.NTAccount($env:USERDOMAIN, "erik")
  7. $sid = $User.Translate([System.Security.Principal.SecurityIdentifier])
  8.  
  9. $null = New-PSDrive -PSProvider Registry -Name HKU -Root HKEY_USERS -ErrorAction SilentlyContinue
  10. Get-ItemProperty "HKU:\$($sid.value)\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement