reg add in powershell - powershell

i need help to use these registry to be be scripted over to powershell language. Anyone how can help me?
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts" /v "Helvetica LT Bold (TrueType)" /t REG_SZ /d HelveticaBold.ttf /f
As I'm quite a beginner in powershell, I've tried to search around here and on the web but can't find any ways to solve it.

Related

Is WebView2 supported in the Citrix Server

We have an application from third party, it requires WebView2. Installed WebView2 in our machine as per instruction, it is working fine in our desktop.
We installed exactly in the same way in the Citrix server, but it is not working. Any idea if the Citrix Server supports WebView2 or any specific action needed. The third Party does not provide customer support for the Citrix installation - Please help.
We had a similar issue with WebView2. It worked just fine everywhere, except on our Citrix environment.
The solution that made it work for "msedgewebview2.exe" is described here: https://support.citrix.com/article/CTX107825
REG ADD HKLM\SOFTWARE\Citrix\CtxHook /v ExcludedImageNames /t REG_EXPAND_SZ /d msedgewebview2.exe /f
REG ADD HKLM\SOFTWARE\Wow6432Node\Citrix\CtxHook /v ExcludedImageNames /t
REG_EXPAND_SZ /d msedgewebview2.exe /f
REG ADD HKLM\SOFTWARE\Wow6432Node\Citrix\CtxHook64 /v ExcludedImageNames /t
REG_EXPAND_SZ /d msedgewebview2.exe /f

Unlock the reading pane in outlook 2016

How do you write a script to change a registry key? What I am trying to do is have a script I can run to unlock the reading pane in outlook 2016.
The path of the registry key is:
Computer\HKEY_CURRENT_USER\Software\Policies\Microsoft\office\16.0\outlook\options
disablereadingpane REG_DWORD 0x00000001 (1)
And I need to change the 1 to a 0. In the 0x00000001
Any help getting started with this would be greatly appreciated.
My comment was faulty it's add not edit.
reg.exe is the command line registry manipulation tool. See reg.exe /?
You may first check if the key exists and what value / data it has.
Reg Query "HKCU\Software\Policies\Microsoft\office\16.0\outlook\options"
To adda key/value/data pair
Reg add "HKCU\Software\Policies\Microsoft\office\16.0\outlook\options" /v disablereadingpane /t REG_DWORD /d 0x0
optionally you may add a /f force option to overwrte current content.
I think you're looking for something like this, if you're using powershell. It's pretty self explanatory
Set-ItemProperty -Path HKCU:\Software\Policies\Microsoft\office\16.0\outlook\options -Name disablereadingpane -Value 0

How can I change Local Security Policy through comand line

I have a windows 10 machine and I need to change the Security settings to not defined for Local Security Policy->Local Policies->Security Options->
DCOM:Machine Launch Restrictions in SDDL syntax
and
DCOM:Machine Access Restrictions in SDDL syntax from a command line.
Would anybody know how to do this?
REG DELETE "HKLM\SOFTWARE\Wow6432Node\Policies\Microsoft\Windows NT\DCOM " /v MachineLaunchRestriction /f
REG DELETE "HKLM\SOFTWARE\Wow6432Node\Policies\Microsoft\Windows NT\DCOM " /v MachineAccessRestriction /f
Deleting the keys worked

RunOnceEx - Reboot System after each Installation

Is there any way I can reboot my computer after each component installation specified in RunOnceEx.CMD file?
I am creating a unattended setup disk for windows XP which would install some default software after installing windows on the system. I am using RunOnceEx.cmd file to define the software that needs to be installed, what I want is to reboot my the system after installation of each software.
Thanks and regards,
Yep there is. Although it's not a supported feature. I do something similar.
This might not be the the fanciest solution but it works reliably. The key is to stop the RunOnceEx process (rundll32.exe) before commencing the reboot procedure. If it's not stopped, Windows will stop all processes before shutting down in an unknown order. And if that order means killing our "Reboot" process before killing the RunOnceEx process it will continue on the next item on the RunOnceEx list before being killed (and thus aborted, which is not what we want).
The simple answer, add a reboot key that kills the RunOnceEx process and then reboots:
set %KEY%=HKLM\Software\Microsoft\Windows\CurrentVersion\RunOnceEx
REG ADD %KEY%\009 /ve /D "Reboot.." /f
REG ADD %KEY%\009 /v 1 /D "cmd.exe /c taskkill.exe /f /im rundll32.exe & shutdown /r /t 0 /f" /f
This might leave remnant keys during next startup. So to make it look cleaner, add an instruction to remove the key manually before killing and rebooting:
set %KEY%=HKLM\Software\Microsoft\Windows\CurrentVersion\RunOnceEx
REG ADD %KEY%\009 /ve /D "Reboot.." /f
REG ADD %KEY%\009 /v 1 /D "cmd.exe /c REG DELETE %key%\009 /va /f & taskkill.exe /f /im rundll32.exe & shutdown /r /t 0 /f" /f
Hope it helps.
Edit:
In XP you might have to use tskill instead of taskkill, but the principle is the same.

How can I automate the process of customizing the command prompt?

I spend most of my time on command line ( XP / 7 ) and always find myself customizing the command prompt according to my preferences. This applies to both cmd and powershell prompt.
Width: 140
Height: 40
Left: -4
Top: 20
Font: Lucida Console
Font Size: 16
Text Color: RGB(100,150,200)
QuickEdit Mode: Enabled
Whenever I am on a new server, I would need to do this all over again. How can I automate this process by putting these parameters in a batch file or PowerShell script?
You can look into making calls to update the Windows registry.
For example,
REG.EXE add HKCU\Console /v QuickEdit /t REG_DWORD /d 1 /f
will set QuickEdit as the default mode for your command prompt.
It's easy to slap this line into a batch file, along with other settings.
add Keyname will chose the Key name where to add the value, here HKEY_CURRENT_USER\Console
/v is followed by the name of the value to add
/t followed by its type
/d is followed by the data with which to set the name of the value
/f to force write in the registry without prompt
Likewise, you can modify WindowSize which contains 0xhhhhwwww where the first four bytes is the value of the height in hexa (e.g. 0x003E for a height of 62 pixels) and www is the window's width. For your case:
REG.EXE add HKCU\Console /v WindowSize /t REG_DWORD /d 0x0028008c /f
Type REG /? and REG add /? for more options.
You can use the Registry provider in PowerShell along with the *-Item and *-ItemProperty cmdlets to modify the registry values under this registry key: HKEY_CURRENT_USER\Console.