Kace Script to Add a Registry Entry with the Computer Name
I'm trying to create a script that will add a registry entry with the computer name:
[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\WebExSilentInstaller]
"Name"="ExampleComputerName"
Where "ExampleComputerName" is the computer name.
I need to create this entry on every computer within Kace and need to replace the "ExampleComputerName" with the current computer name.
Is this possible?
0 Comments
[ + ] Show comments
Answers (1)
Please log in to answer
Posted by:
scottcopus
4 years ago
via cmd/batch:
reg.exe add "HKLM\SOFTWARE\WOW6432Node\WebExSilentInstaller" /v "Name" /t REG_SZ /d "%COMPUTERNAME%" /f
via PowerShell:
$regPath = "HKLM:\SOFTWARE\WOW6432Node\WebExSilentInstaller"
New-Item -Path $regPath -ErrorAction SilentlyContinue | Out-Null
New-ItemProperty -Path $regPath -Name "Name" -Value "$env:COMPUTERNAME" -PropertyType String -Force | Out-Null
cheers,
Scott
Comments:
-
Scott, you are awesome! That worked like charm! - mcclainr@tessco.com 4 years ago
-
So it worked on my computer when updating the registry but when I run the script for another computer in the Kace inventory it adds MY computer name into the registry.
Is there a Kace variable that I can use for the computer I'm adding the registry entries too? - mcclainr@tessco.com 4 years ago-
Have you confirmed that your computer's name is on those remote computers' registries by manually checking them? Run the scripts locally on a couple other boxes and see if they work there. - scottcopus 4 years ago
-
We are in the process of upgrading from Kace 8 to Kace 10. I created the script on the Kace 10 server and it works perfect with a few test computers that I have on there. It was when I exported/imported into the Kace 8 server that it didn't seem to work. I will wait until everyone is on the new server to install the software. Thanks for your help! - mcclainr@tessco.com 4 years ago