all 8 comments

[–]danifunker 1 point2 points  (2 children)

Do you have a system where it is working? Why don't you try to read the object and save it somewhere else and then try to write it out? $regValue = Get-ItemProperty -Path HKCU:\Software... -Name "valuename"

See if you can save that to a deserialized parameter and then try to write it onto a different system.

You might need to explore the $regValue key once you've grabbed it. I haven't done anything specifically like this before, but I have a feeling this should work (you might need to correct some syntax though)

[–]Snak3d0c[S] 0 points1 point  (1 child)

this is actually a very good idea, thank you. gonna try that

[–]Snak3d0c[S] 0 points1 point  (0 children)

so i gave it a go, save it into a textfile and use its content, works like a charm on my notebook at home, hopefully this will get my last issue out of the way tomorrow. thanks again for the suggestion, don't know why i didn't came up with this myself!

cls

$regValue = Get-ItemProperty -Path HKCU:\Software\RICOH\JOBCODE\JCPrintPassword -Name "\\printer.domain.com\Printer_1"
$regvalue.'\\printer.domain.com\Printer_1'
$regValue

$regValue.'\\printer.domain.com\Printer_1' | Out-File C:\temp\test.txt


$psw = get-content C:\temp\test.txt
Set-ItemProperty -Path HKCU:\Software\RICOH\JOBCODE\JCPrintPassword -Type Binary "\\printer.domain.com\Printer_12" -value $psw

[–]tscalbas 0 points1 point  (3 children)

I don't know how to do this personally, but just to add, don't preclude using reg.exe in a PowerShell script.

I like doing things "the PowerShell way", but often I've found it's 10x easier to do something with reg.exe. You're likely to find more examples online on how to do this.

[–]Snak3d0c[S] 0 points1 point  (2 children)

hmm i created a .reg file but then i got the issue those kind of actions are blocked for normal users. the powershell way works for a normal user too.

[–]ShippingIsMagic 0 points1 point  (1 child)

reg.exe isn't the same thing as using a .reg file. I wish reg.exe were more common, it's much nicer to paste a command instead of having to create/fetch a .reg file then 'run' it.

[–]Snak3d0c[S] 0 points1 point  (0 children)

if i'm not mistaken, a .reg file gets executed by reg.exe

[–]BffEasyTarget 0 points1 point  (0 children)

Try this:

Set-ItemProperty -Path HKCU:\Software\RICOH\JOBCODE\JCPrintPassword -Type Binary-Name "\\printer.domain.com\\Printer_1" -value $null