Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

New-PSdrive registry, (scope and Persist )

$
0
0

Buenos dias everyone,

I have the following fucntion, I was hoping to be able to load the regisry profile with the New-PsDrive.
i want to access the registry from different users but the PSDrive mounting point only stays within the function.
There is a -Persist option but it is only valid for network drives and not for registry. 
I could call this New-PsDrive in every other function where I am doing the processing of the registry but I was wondering if there was some other way to workaround this. 

Thanks in advance for your help.

Regards,
Jacobo

 

functionload-profile

{
param (
[Parameter(
Mandatory=$true,
ValueFromPipeline=$true
)]
[String[]]$Users
)

Process
{
foreach ($userin$Users)
{
Reg Load "hklm\$user""\\SERVER\Userprofiles$\$user\UPM_Profile\NTUSER.DAT"
New-Psdrive-Name$user-PSProvider Registry -Root hklm\$user


}
}
}

Viewing all articles
Browse latest Browse all 6937

Trending Articles