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

DeviceConfiguration_Import_FromJSON.ps1 #271

Open
davenish opened this issue May 20, 2024 · 2 comments
Open

DeviceConfiguration_Import_FromJSON.ps1 #271

davenish opened this issue May 20, 2024 · 2 comments

Comments

@davenish
Copy link

DeviceConfiguration_Import_FromJSON.ps1 is no longer working

@charliedontsurf
Copy link

Not OP but when I run DeviceConfiguration_Import_FromJSON.ps1

Please specify your user principal name for Azure Authentication: ga@redacted.onmicrosoft.com

Checking for AzureAD module...
AzureAD PowerShell module not found, looking for AzureADPreview
Exception calling "LoadFrom" with "1" argument(s): "Could not load file or assembly 'file:///C:\Program
Files\WindowsPowerShell\Modules\AzureADPreview\2.0.2.183\Microsoft.IdentityModel.Clients.ActiveDirectory.dll' or one
of its dependencies. The system cannot find the file specified."
At C:\Users\Mikey\Desktop\DeviceConfiguration\DeviceConfiguration_Import_FromJSON.ps1:87 char:1

  • [System.Reflection.Assembly]::LoadFrom($adal) | Out-Null
  •   + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
      + FullyQualifiedErrorId : FileNotFoundException
    
    

Exception calling "LoadFrom" with "1" argument(s): "Could not load file or assembly 'file:///C:\Program
Files\WindowsPowerShell\Modules\AzureADPreview\2.0.2.183\Microsoft.IdentityModel.Clients.ActiveDirectory.Platform.dll'
or one of its dependencies. The system cannot find the file specified."
At C:\Users\redacted\Desktop\DeviceConfiguration\DeviceConfiguration_Import_FromJSON.ps1:89 char:1

  • [System.Reflection.Assembly]::LoadFrom($adalforms) | Out-Null
  •   + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
      + FullyQualifiedErrorId : FileNotFoundException
    
    

Cannot find type [Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContext]: verify that the assembly containing this type is loaded.

@andreea1987
Copy link

@charliedontsurf To fix that error just run Install-Module -Name AzureAD -RequiredVersion 2.0.2.140 and Install-Module -Name Microsoft.Graph
Now I’m getting a different error, seems like the script is incomplete.
Test-Path : Cannot bind argument to parameter 'Path' because it is an empty string. At C:\Intune\DeviceConfiguration_Import_FromJSON.ps1:317 char:21 + If (Test-Path -Path $FileName -Type Leaf) { + ~~~~~~~~~ + CategoryInfo : InvalidData: (:) [Test-Path], ParameterBindingValidationException + FullyQualifiedErrorId : ParameterArgumentValidationErrorEmptyStringNotAllowed,Microsoft.PowerShell.Commands.Test PathCommand You cannot call a method on a null-valued expression. At C:\Intune\DeviceConfiguration_Import_FromJSON.ps1:324 char:1 + $ImportPath = $ImportPath.replace('"','') + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [], RuntimeException + FullyQualifiedErrorId : InvokeMethodOnNull Test-Path : Cannot bind argument to parameter 'Path' because it is an empty string. At C:\Intune\DeviceConfiguration_Import_FromJSON.ps1:326 char:16 + if(!(Test-Path "$ImportPath")){ + ~~~~~~~~~~~~~ + CategoryInfo : InvalidData: (:) [Test-Path], ParameterBindingValidationException + FullyQualifiedErrorId : ParameterArgumentValidationErrorEmptyStringNotAllowed,Microsoft.PowerShell.Commands.Test PathCommand Get-Content : Cannot bind argument to parameter 'Path' because it is an empty string. At C:\Intune\DeviceConfiguration_Import_FromJSON.ps1:337 char:17 + $JSON_Data = gc "$ImportPath" + ~~~~~~~~~~~~~ + CategoryInfo : InvalidData: (:) [Get-Content], ParameterBindingValidationException + FullyQualifiedErrorId : ParameterArgumentValidationErrorEmptyStringNotAllowed,Microsoft.PowerShell.Commands.GetC ontentCommand ConvertFrom-Json : Cannot bind argument to parameter 'InputObject' because it is null. At C:\Intune\DeviceConfiguration_Import_FromJSON.ps1:340 char:30 + $JSON_Convert = $JSON_Data | ConvertFrom-Json | Select-Object -Proper ... + ~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidData: (:) [ConvertFrom-Json], ParameterBindingValidationException + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.ConvertFrom JsonCommand

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

3 participants