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
}
}
}
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
}
}
}