registry - Loading ntuser.dat with powershell -
i need check settings users on windows clients in network. users have roaming profiles.
i have written powershell script loads offline copy of users' ntuser.dat , reads out specific keys. file unloaded , next 1 loaded registry.
the problem after 10 users no new files loaded. when script launched again users still don't load. new users after close powershell prompt , open new one. script stalls after 10 users.
$userlist = ls "c:\temp calls\profiles" foreach ($user in $userlist){ $username = $user.name #$username = "ciproda" reg load "hklm\$username" "c:\temp calls\profiles\$username\ntuser.dat" | out-null ... here check keys ... [gc]::collect() start-sleep -s 3 reg unload "hklm\$username" }
in section 'here check keys', mounting hive ps drive using like:
new-psdrive -name <blah> -psprovider registry -root <blih> cd <blah>: # set-itemproperty , get-itemproperty calls here referring # psdrive , using powershell variables remove-psdrive <blah>
if still have references of psdrive variables before calling reg unload, call might fail. try remove variables still refer psdrive through remove-variable
.
Comments
Post a Comment