Need Help with Desktop Shortcut(s) Launching to Check and Write to Registry

Any help would be VERY appreciated.
I’m new into Powershell and inherited a project at work that is a more advanced than my current knowledge of this.

I have two desktop shortcuts that launch modules to an application. One is called “Review”, the other “Validation”.

Our Users move around a lot to other workstations. There are user-specific settings that I want to have checked at Review or Validation shortcut launch, and IF they do not exist, write them to their respective Reg locations before opening the the modules.

Reason: This seems to the be only way to truly prevent AutoOpenNextBatch

These are the Reg keys I’m looking to check/write. If they already exist for the user, it can ignore.

HKCU\Software\Kofax\Transformation\4.0\DocumentReview
• AutoCloseBatch = 0
• AutoOpenNextBatch = 0
• ExpandProblemsOnLoad = 2

HKCU\Software\Kofax\Transformation\4.0\Validation
• AutoOpenNextBatch = 0
• ConfirmDocSaving = 0

Huge thanks to anyone that give me some direction here.

[pre]

Review

if ([string]::IsNullOrEmpty((Get-ItemProperty -Path HKCU\Software\Kofax\Transformation\4.0\DocumentReview -ErrorAction SilentlyContinue).AutoCloseBatch))
{
Set-ItemProperty -Path HKCU\Software\Kofax\Transformation\4.0\DocumentReview -Name AutoCloseBatch -Value 0
}

if ([string]::IsNullOrEmpty((Get-ItemProperty -Path HKCU\Software\Kofax\Transformation\4.0\DocumentReview -ErrorAction SilentlyContinue).AutoOpenNextBatch))
{
Set-ItemProperty -Path HKCU\Software\Kofax\Transformation\4.0\DocumentReview -Name AutoCloseBatch -Value 0
}

if ([string]::IsNullOrEmpty((Get-ItemProperty -Path HKCU\Software\Kofax\Transformation\4.0\DocumentReview -ErrorAction SilentlyContinue).ExpandProblemsOnLoad))
{
Set-ItemProperty -Path HKCU\Software\Kofax\Transformation\4.0\DocumentReview -Name AutoCloseBatch -Value 2
}

Validation

if ([string]::IsNullOrEmpty((Get-ItemProperty -Path HKCU\Software\Kofax\Transformation\4.0\Validation -ErrorAction SilentlyContinue).AutoOpenNextBatch))
{
Set-ItemProperty -Path HKCU\Software\Kofax\Transformation\4.0\DocumentReview -Name AutoCloseBatch -Value 0
}

if ([string]::IsNullOrEmpty((Get-ItemProperty -Path HKCU\Software\Kofax\Transformation\4.0\Validation -ErrorAction SilentlyContinue).ConfirmDocSaving))
{
Set-ItemProperty -Path HKCU\Software\Kofax\Transformation\4.0\DocumentReview -Name AutoCloseBatch -Value 0
}

[/pre]

Thank you, Kiran. I’m looking forward to trying this. The one thing I still need to figure out is how to run this each time the shortcut(s) are launched.
Any suggestions?

You can create a ‘.ps1’ file and run the script before you can run the shortcut or add this script to your main script or function.

Awesome! Thank you, Kiran

one thing to note in Kiran’s code is the path will be an issue. HKCU is a PSDrive and needs a colon before the path. See below for an example:

[pre]

Get-ItemProperty -Path HKCU:\software\Microsoft\Calc

Get-ItemProperty -Path HKCU\software\Microsoft\Calc

[/pre]

 

That’s correct, I didn’t notice, just copied it from @BigDaddyB92 original post.

Thank you.

Good catch! Thanks, Logan.