microsoftgraph/powershell-intune-samples

DeviceConfiguration_Import_FromJSON.ps1 not working

MDanihy opened this issue · 1 comments

Test-Path : Cannot bind argument to parameter 'Path' because it is an empty string.
At D:\Desktop\Endpoint\DeviceConfiguration_Import_FromJSON.ps1:312 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 D:\Desktop\Endpoint\DeviceConfiguration_Import_FromJSON.ps1:319 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 D:\Desktop\Endpoint\DeviceConfiguration_Import_FromJSON.ps1:321 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 D:\Desktop\Endpoint\DeviceConfiguration_Import_FromJSON.ps1:332 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 D:\Desktop\Endpoint\DeviceConfiguration_Import_FromJSON.ps1:335 char:30

  • $JSON_Convert = $JSON_Data | ConvertFrom-Json | Select-Object -Proper ...
  •                          ~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidData: (:) [ConvertFrom-Json], ParameterBindingValidationException
    • FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.ConvertFrom
      JsonCommand
LSTEK commented

I was using this to do a production migration but got stuck here. if it helps i went back a few versions and got it working. https://github.com/microsoftgraph/powershell-intune-samples/releases/tag/203934 (this is the version i used)