OSDeploy / OSD

OSD Shared Functions
MIT License
149 stars 61 forks source link

Bug in Select-OSDCloudFileWim.ps1 #108

Closed JHBDO closed 7 months ago

JHBDO commented 8 months ago

Describe the bug In WinPE, error:

"Method invocation failed because [System.IO.FileInfo] does not contain a method named 'op_Addition'. At X:\Program Files\WindowsPowerShell\Modules\OSD\24.1.11.1\Public\OSDCloudTS\Select-OSDCloudFileWim.ps1:17 $Results += Find-OSDCloudFile -Name '*.esd' -Path '\OSDCloud\OS\'

Same thing again, except .install.swm' instead of .esd. Issue appears to be related to having mutiple image files.

To Reproduce Place any WIM file in C:\OSDCloud\OS Place any ESD file in the OSDCloud\OS on the USB drive. Run Start-OSDCloud -Firmware -FindImageFile I believe this error happens because the machine I'm attempting to image has previously been imaged with OSDCloud, which leaves behind the wim image file in C:\OSDCloud\OS when it's done. Select-OSDCloudFileWim can't handle more than one image file. In additon, if it finds an ESD file in OSDCloud\OS on the USB drive, the next line that checks for a *.swm file throws the error message above.

Expected behavior Script should be able to handle multiple wim/esd files, or just ignore the one in C:\OSDCloud.

Using OSD 24.1.11.1 Called via Start-OSDCloud -Firmware -FindImageFile

gwblok commented 8 months ago

Does this only happen if you have files still on C:\? If you clear out that folder first, all is well?

JHBDO commented 8 months ago

I've only seen it happen when I have files still on C:, but I would assume it would also happen if there were multiple wim/esd/swm files on the USB drive as well. It's not a scenario I'll have, so I didn't test it. If I delete any esd/wim file from C: before the command runs, it works correctly. However, even then I still see that error message when it hits the check for a SWM file (I'm using ESD, and the SWM check is after the ESD check), but it still continues.

gwblok commented 8 months ago

That's interesting, I have a lot of esd files, swm files, and a wim file on my flash drive, and I haven't seen issues. I'm planning to update the function to ignore files on C:, hopefully that will resolve it for you. image

If you want to make those small edits in your module file, and see if that resolves it, that would be great. I'll try to test later this week.

gwblok commented 8 months ago

when does the error occur? I've been unable to reproduce it (before modifying the code) Test, I copied a bunch of images to the C Drive, then used your command to try to repo:

Test 1 with ESD File image image

Test 2 with WIM file

image

gwblok commented 7 months ago

This should be resolved at this point, as it ignores C:\ If you have any additional issues, please reopen.