Powershell script with LAPS and no local file copy

0

I have the following Powershell script that I am using within a deployment to install drivers.

$Driverpath = "C:\drivers\dell"

$driversCollection = Get-ChildItem -Path $Driverpath -Filter "*.inf" -Recurse -ErrorAction SilentlyContinue |
Select-Object -ExpandProperty Fullname
foreach($driver In $driversCollection){
# Add and install driver package
pnputil.exe -i -a $driver | Out-File c:\driver.log -Append
}

The script is the second step in the deployment the first step copies the driver folder from the PDQdeploy repository to the C:\drivers\dell directory on the local computer. Is there a way to have the powershell script use the driver files directly from the repository directory without having to copy them locally. I am using LAPS.

 

Thanks

Cancel
login to comment
0

That is the problem the LAPS user does not have rights to the files. I need to work around that. 

Cancel
login to comment

0

Sure, as long as the LAPS user has rights to them. Get-ChildItem supports UNC paths. 

Get-ChildItem "\\pdqserver\Repository\DellDrivers" -Filter "*.inf" -Recurse | Select-Object -expandproperty Fullname

That should do what you want. Test it first of course, and change that UNC to the right thing. Let me know if you need more help.

 

I'm not sure it pnputil will support the UNC path. I can't find a good answer from the googles. Worst you can do is try it and find out.

Cancel
login to comment

Reply