Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PS Script fails for Get-ItemProperty Registry #56

Open
TassieTrooper opened this issue Nov 24, 2022 · 0 comments
Open

PS Script fails for Get-ItemProperty Registry #56

TassieTrooper opened this issue Nov 24, 2022 · 0 comments

Comments

@TassieTrooper
Copy link

Hi,

I keep stumbling on reading the registry via an Intune Script.

I have tried the registry path with:
Registry::HKEY_LOCAL_MACHINE\SOFTWARE...
Registry::HKLM\SOFTWARE...
HKLM:SOFTWARE.....
HKLM:\SOFTWARE....

This is my command, which works fine from PowerShell:
Get-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Provisioning\Diagnostics\AutoPilot -Name 'DeploymentProfileName' | Select-Object 'DeploymentProfileName' -ExpandProperty 'DeploymentProfileName'

Intune Log records the fail as:
<![LOG[[PowerShell] Fail, the details are {"Version":1,"SigningCode":649,"SigningMsg":"(Success) AccountId:00fa6d33-858d-4d5b-9ed2-80dfca1b527b,PolicyId:d5043367-ae81-4ec1-b8c7-684d6d62045d,Type:1,Enforce: Enforcement2. OSVersion:10.0.22621,AgentVersion:1.60.206.0. ","ExecutionMsg":"Get-ItemProperty : Cannot find path 'HKLM:\SOFTWARE\Microsoft\Provisioning\Diagnostics\AutoPilot' because it does not \r\nexist.\r\nAt C:\Program Files (x86)\Microsoft Intune Management \r\nExtension\Policies\Scripts\c9e33b9e-6140-4340-ba29-42028da8c153_d5043367-ae81-4ec1-b8c7-684d6d62045d.ps1:12 char:20\r\n+ ... lotConfig = Get-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Provision ...\r\n+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n + CategoryInfo : ObjectNotFound: (HKLM:\SOFTWARE\...stics\AutoPilot:String) [Get-ItemProperty], ItemNotFo \r\n undException\r\n + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetItemPropertyCommand\r\n \r\n\r\n"}]LOG]!><time="10:15:26.0134720" date="11-24-2022" component="IntuneManagementExtension" context="" type="3" thread="85" file="">

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant