export and import reg vallue targeted on servername

This topic contains 1 reply, has 1 voice, and was last updated by Profile photo of Peter Jonkers Peter Jonkers 4 months, 1 week ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #39303
    Profile photo of Peter Jonkers
    Peter Jonkers
    Participant

    Problem:
    RICOH printers installed on three RDS 2012 servers localy. Reason is the adobe PDF print problem to use local installed printers.
    The printers are having the same name and drivers on all the rds servers
    Users want to use the secure printing option. You set a name and a "pin"
    When the user logs in on RDS01 and set the setting then it will work 🙂
    when the user logs in on RDS02 (broker load balancing system) the security settings are not there.

    Reason
    The reg setting for this is different per server and the setting for the other server is deleted.

    What i want to achieve:

    User set the printer setting. The user logs of and the specifiek HKLU setting is exported recursive. The name of the export reg must contain the server name.

    when the user logs in again it looks at a reg name including the servername (name example : rds001printer1.reg)
    then the reg will be imported into the HKLU settings.

    I am not a pro on powershell but i know it can be done.

    any suggestions or examples?

    The reg value would be :
    [HKEY_USERS\{GUIDS-1-5-21-1811062074-1728108066-947299291-5465}\Software\RICOH]

    or
    HKCU\\Software\RICOH]

    #39326
    Profile photo of Peter Jonkers
    Peter Jonkers
    Participant

    To import the reg key I created this script. It works :).
    Any suggestions if this is a way to do it ?

    Set-ExecutionPolicy remotesigned -Force
    $currentDate=get-date -Format "yyyyMMddhhmmss"
    $regkey="HKCU\Printers"
    $strExportPath = "c:\export\"
    $strFilename = $strExportPath+$env:COMPUTERNAME+"printer.reg"
    $strRename = $strFilename+$currentdate
    $n=5
    
    If (Test-Path $strFilename) {
        Rename-Item $strFilename $strRename
        Reg export  $regkey $strFilename
        $items=get-childitem $strExportPath
        $items | Sort-Object lastwritetime -Descending | Select-Object -Last ($items.Count -ge $n) | ForEach-Object {Remove-Item $strExportPath$_ }
    }Else{
        Reg export $regkey $strFilename
    }
    
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.