MSEndpointMgr / Intune

Microsoft Intune scripts
MIT License
644 stars 243 forks source link

Install-Printer.ps1 refuse to run when inf file in a subfolder with spaces #60

Open cliffzhu opened 1 year ago

cliffzhu commented 1 year ago

Install-Printer.ps1 refuse to run when inf file in a subfolder's name with a space.

GiraffDK commented 4 months ago

I get the same error - I can see that it's the pnputil that is making the mess.

@cliffzhu did you come though with a working method?

krilumino commented 2 months ago

In the Install-Printer.ps1 I modified the $INFARGS to add quotes around the file path. This allows spaces to be used when referencing the .inf file.

Original version: $INFARGS = @( "/add-driver" "$INFFile" )

My version: $INFARGS = @( "/add-driver " + '"' + $INFFILE + '"' )

It may be a sloppy way of doing it, but it seems to work.