Keep in mind that the below commands can also be wrapped into an 'Invoke-Command' - You just need to make sure WinRM* is enabled on the remote computer -
I'll list out below, how I deal with WinRM enablement.*
Get each of these values:
NOTE - Two different Registry locations; 'HKEY_USERS\.DEFAULT', and 'HKEY_CURRENT_USER'
(Get-ItemProperty -Path Registry::"HKEY_USERS\.DEFAULT\Control
Panel\Keyboard" -Name InitialKeyboardIndicators).InitialKeyboardIndicators
(Get-ItemProperty -Path Registry::"HKEY_CURRENT_USER\Control
Panel\Keyboard" -Name InitialKeyboardIndicators).InitialKeyboardIndicators
|
If either of these are set to either '0', or '2147483648'...
Add '2' to them, and set the new value accordingly -
So, '0' becomes '2'
And '2147483648' becomes '2147483650'
Examples:
Set-ItemProperty -Path Registry::"HKEY_USERS\.DEFAULT\Control
Panel\Keyboard" -Name InitialKeyboardIndicators -Value 2
Set-ItemProperty -Path Registry::"HKEY_USERS\.DEFAULT\Control
Panel\Keyboard" -Name InitialKeyboardIndicators -Value 2147483650
Set-ItemProperty -Path Registry::"HKEY_CURRENT_USER\Control
Panel\Keyboard" -Name InitialKeyboardIndicators -Value 2
Set-ItemProperty -Path Registry::"HKEY_CURRENT_USER\Control
Panel\Keyboard" -Name InitialKeyboardIndicators -Value 2147483650
|
* The WinRM stuff:
Hint: Your gonna need PsExec from the SysInternals suite...
(Also, forgive the aliases I used here and there...)
$Computer_Name = "ComputerName" # WinRM test $EAC = $ErrorActionPreference $ErrorActionPreference = "SilentlyContinue" If (!((Test-NetConnection $Computer_Name).PingSucceeded)) {Write-Host " $Computer_Name is unreachable..."; break} $TestCommand = $null;
$TestCommand = Test-WSMan -ComputerName $Computer_Name If
(!($TestCommand)){ Write-Host " Enabling WinRM... " -No C:\SysInternals\PsExec.exe -s -nobanner \\$Computer_Name /accepteula cmd /c "c:\windows\system32\winrm.cmd quickconfig -quiet" | Out-Null $TestCommand = $null;
$TestCommand = Test-WSMan -ComputerName $Computer_Name If
(!$TestCommand){Write-Host "Windows Remote Managment (WinRM) did not enable... Can't
run this - EXITING." -Fore Yellow -Back DarkMagenta; Break} }
If ($TestCommand){
Write-Host " WinRM
enabled." -Fore Yellow -Back 2
} $ErrorActionPreference = $EAC # END WinRM test
|