ConnectWise Control Software User Forum
»
Default
»
Tips and Tricks
»
Running powershell command with Get-ItemProperty reporting cannot find path
 Rank: Member Medals:  Joined: 6/17/2013(UTC) Posts: 29
Thanks: 10 times Was thanked: 2 time(s) in 2 post(s)
|
Running this in the native windows Powershell ISE works:
powershell Get-ItemProperty -Path 'hklm:software\microsoft\windows\currentversion\DeliveryOptimization\Config' -Name "DODownloadMode"
DODownloadMode : 3 PSPath : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\software\microsoft\windows\currentversion\DeliveryOptimization\Conf ig PSParentPath : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\software\microsoft\windows\currentversion\DeliveryOptimization PSChildName : Config PSDrive : HKLM PSProvider : Microsoft.PowerShell.Core\Registry
When trying to run in the screenconnect commands toolbox:
powershell Get-ItemProperty -Path 'hklm:software\microsoft\windows\currentversion\DeliveryOptimization\Config' -Name "DODownloadMode"
I get the error: C:\Windows\system32>powershell Get-ItemProperty -Path 'hklm:software\microsoft\windows\currentversion\DeliveryOptimization\Config' -Name "DODownloadMode" Get-ItemProperty : Cannot find path 'HKLM:\software\microsoft\windows\currentversion\DeliveryOptimization\Config' because it does not exist. At line:1 char:1 + Get-ItemProperty -Path 'hklm:software\microsoft\windows\currentversio ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (HKLM:\software\...mization\Conf ig:String) [Get-ItemProperty], ItemNotFoundException + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetIt emPropertyCommand
I'm thinking it's not formatting the text strings with \'s properly?
Thx, David
|
|
|
|
 Rank: Administration Medals:  Joined: 3/28/2014(UTC) Posts: 2,862  Thanks: 3 times Was thanked: 351 time(s) in 303 post(s)
|
Hmm, while I don't have that exact key, I can't find one that will cause that problem.
What version of ScreenConnect are you using?
Does this command fail against any Guest machine or just a specific few? |
ScreenConnect Team |
|
|
|
 Rank: Member Medals:  Joined: 6/17/2013(UTC) Posts: 29
Thanks: 10 times Was thanked: 2 time(s) in 2 post(s)
|
This is the registry key in all Windows 10 that changes Start Menu | Settings | Update and Security | Windows Update | Advanced Options | Choose how updates are delivered. 0 is off. 1 is "PCs on my local network" and 3 is "PCs on my local network, and PCs on the Internet"
I just tried it on 5 different win10 machines, all the same error. Note that the powershell command runs fine on the one machine when you run it from the console inside the native windows powershell ISE environment. On that same machine using the screenconnect "Command" function it fails, so something in screenconnect is changing the command?
Screenconnect 5.6.10870.6001
Thx David
|
|
|
|
 Rank: Administration Medals:  Joined: 3/28/2014(UTC) Posts: 2,862  Thanks: 3 times Was thanked: 351 time(s) in 303 post(s)
|
It could be the parsing, but I would expect other, similar commands with the same structure to fail.
Regardless, I can replicate the failure against Win10 machines with that specific command, so I'm registering it as a defect and I'll continue to investigate. Thanks for the report! |
ScreenConnect Team |
|
|
|
 Rank: Advanced Member Medals:  Joined: 2/28/2014(UTC) Posts: 39  Thanks: 4 times Was thanked: 8 time(s) in 5 post(s)
|
It's probably because ScreenConnect runs the 32 bit version of powershell which reads/write values under the WOW6432Node part of the Windows registry. If you want to run the 64 bit version of powershell use the following: c:\windows\sysnative\windowspowershell\v1.0\powershell.exe Example: c:\windows\sysnative\windowspowershell\v1.0\powershell.exe -command "Get-ItemProperty -Path 'hklm:software\microsoft\windows\currentversion\DeliveryOptimization\Config' -Name 'DODownloadMode'" (Note: Be sure to use single quotes inside of the powershell command. Edited by user Monday, April 10, 2017 3:35:03 AM(UTC)
| Reason: Not specified
|
|
|
|
ConnectWise Control Software User Forum
»
Default
»
Tips and Tricks
»
Running powershell command with Get-ItemProperty reporting cannot find path
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.