rbalsleyMSFT / FFU

Using Full Flash Update files to speed up Windows Deployment
MIT License
76 stars 17 forks source link

"you cannot call a method on a null valued expression." Line 129, character 1 of the script #6

Closed rbalsleyMSFT closed 11 months ago

rbalsleyMSFT commented 11 months ago
          This is a great set of tools. Thank you!

Does the SSD of the target machine have to be in a certain condition prior to FFU application? ApplyFFU.ps1 throws an error indicating it "you cannot call a method on a null valued expression." Line 129, character 1 of the script. This happens if I wipe the SSD first with the BIOS utility or try to apply over an existing install.

Originally posted by @jaywatkins in https://github.com/rbalsleyMSFT/FFU/issues/4#issuecomment-1835022877

rbalsleyMSFT commented 11 months ago

Hi Jay,

Shouldn't need to be in a certain condition.

You're erroring on this line.

image

Can you add your scriptlog.txt file? That file should be on the deploy partition of the USB drive. The script is using WMI to get the hard drive information. Specifically, it uses this

image

My guess is that the script isn't finding the disk for some reason. The scriptlog.txt file will help tell me that.

Thanks, Richard

jaywatkins commented 11 months ago

Hi,

Here it is. Thanks again!

11/30/2023 9:06:47 AM Begin Logging 11/30/2023 9:06:47 AM Script version: 2309.2 11/30/2023 9:06:47 AM Physical DeviceID is 11/30/2023 9:06:47 AM DiskID is 11/30/2023 9:06:47 AM DiskID is not 0. Need to modify diskpart answer files 11/30/2023 9:06:47 AM Found 1 FFU File 11/30/2023 9:06:47 AM D:\Win11_22H2_Pro_Office_Sep2023.ffu will be installed 11/30/2023 9:06:47 AM No unattend folder found. Device name will be set via PPKG, AP JSON, or default OS name. 11/30/2023 9:06:47 AM No AP files found or AP was not selected 11/30/2023 9:06:47 AM Found 1 PPKG File 11/30/2023 9:06:47 AM D:\PPKG\Win11_092723-01.ppkg will be used 11/30/2023 9:06:47 AM Found 8 driver folders 11/30/2023 9:07:17 AM D:\Drivers\OptiPlex-7090 was selected 11/30/2023 9:07:17 AM Clean Disk 11/30/2023 9:07:17 AM Cleaning disk failed. Exiting

rbalsleyMSFT commented 11 months ago

This is returning nothing:

(Get-WmiObject -Class 'Win32_DiskDrive' | Where-Object {$_.MediaType -eq 'Fixed hard disk media' -and $_.Model -ne 'Microsoft Virtual Disk'}).DeviceID

Can you boot from the USB drive and when the command prompt window shows up where it's running wpeinit, immediately hit ctrl+c to stop it from running the powershell script. It should ask you to terminate the batch job. Hit Y.

Then type powershell and hit enter Then enter Get-WmiObject -Class 'Win32_DiskDrive' | select * | Out-file e:\disk.txt

You might have to change the e:\disk.txt to d:\disk.txt.

Send me that disk.txt file. That should give me the disk configuration

Thanks, Richard

jaywatkins commented 11 months ago

Thanks for your last response. I ran the commands and PowerShell threw a different error. This did not occur on the same physical PC I used when receiving the first PowerShell error. They're the same type of PC, Dell OptiPlex Micro, just different iterations.

disk_ps_eeror.txt

rbalsleyMSFT commented 11 months ago

Can you or have you tried another device?

Can you do a hardware diagnostic to check the memory? Usually the OEM has a tool in the BIOS.

Thanks, Richard


From: Jason Watkins @.> Sent: Friday, December 1, 2023 4:29:53 AM To: rbalsleyMSFT/FFU @.> Cc: Richard Balsley @.>; Author @.> Subject: Re: [rbalsleyMSFT/FFU] "you cannot call a method on a null valued expression." Line 129, character 1 of the script (Issue #6)

Thanks for your last response. I ran the commands and PowerShell threw a different error.

disk_ps_eeror.txthttps://github.com/rbalsleyMSFT/FFU/files/13526511/disk_ps_eeror.txt

— Reply to this email directly, view it on GitHubhttps://github.com/rbalsleyMSFT/FFU/issues/6#issuecomment-1836041506, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AMYE2BAW6QN6ILEROQ7XRN3YHHEUDAVCNFSM6AAAAABACAZ222VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMZWGA2DCNJQGY. You are receiving this because you authored the thread.Message ID: @.***>

jaywatkins commented 11 months ago

I can try the original device, the 7090, on Tuesday. I'll run memory diags on the one I have here (7060).

rbalsleyMSFT commented 11 months ago

Have you gotten the FFU process to work with other devices in the past? I see that the date on the FFU in the file name says Sep, so I'm assuming you built the FFU in the Sep time frame and it has been working with others?

jaywatkins commented 11 months ago

I have gotten this to work several times in the past. It just the last few tries on previously-tested hardware (the exact same ones) stopped working. I wiped my 7060s SSD and used MDT to install Windows 11, like we do regularly. This is how I anticipate future customers for the FFU script will be before that script is run. I then used the FFU script and it worked fine. No errors. I wonder if the script is looking for the various partitions that are created by a normal install and those that were failing didn't have those.

rbalsleyMSFT commented 11 months ago

It isn't. It's just trying to hit the Win32_diskdrive class in WMI. This should be fairly easy to do from WinPE.

Good to hear this has worked before. For these devices, do they have any sort of 3rd party disk encryption or hardware encryption?

Thanks, Richard


From: Jason Watkins @.> Sent: Saturday, December 2, 2023 7:33:00 AM To: rbalsleyMSFT/FFU @.> Cc: Richard Balsley @.>; Author @.> Subject: Re: [rbalsleyMSFT/FFU] "you cannot call a method on a null valued expression." Line 129, character 1 of the script (Issue #6)

I have gotten this to work several times in the past. It just the last few tries on previously-tested hardware (the exact same ones) stopped working. I wiped my 7060s SSD and used MDT to install Windows 11, like we do regularly. This is how I anticipate future customers for the FFU script will be before that script is run. I then used the FFU script and it worked fine. No errors. I wonder if the script is looking for the various partitions that are created by a normal install and those that were failing didn't have those.

— Reply to this email directly, view it on GitHubhttps://github.com/rbalsleyMSFT/FFU/issues/6#issuecomment-1837183203, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AMYE2BHWRGOVC4GWMHSOFRTYHNC2ZAVCNFSM6AAAAABACAZ222VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMZXGE4DGMRQGM. You are receiving this because you authored the thread.Message ID: @.***>

jaywatkins commented 11 months ago

I didn't think it was that specific as far as the disk config. Would the script care if it was going to use an M.2 SSD vs. a SATA SSD? We only use the stock encryption tools, Bitlocker. Interesting you asked that because on some of these OptiPlex Micro's, Bitlocker is enabled by default without us setting it that way. Policy requires us to encrypt our laptops and that is done through software provisioning steps after Windows has been installed and gone through OOBE. This isn't the case for desktops. The only other measures take are Secure Boot. That's it.

rbalsleyMSFT commented 11 months ago

M2, Secureboot, etc shouldn't matter. The script just can't read win32_diskdrive for some reason.

The auto bitlocker is done since the device supports connected/modern standby. That's expected.

Did you get a chance to run the memory diag on the 7060?

Thanks, Richard


From: Jason Watkins @.> Sent: Saturday, December 2, 2023 10:15:51 AM To: rbalsleyMSFT/FFU @.> Cc: Richard Balsley @.>; Author @.> Subject: Re: [rbalsleyMSFT/FFU] "you cannot call a method on a null valued expression." Line 129, character 1 of the script (Issue #6)

I didn't think it was that specific as far as the disk config. Would the script care if it was going to use an M.2 SSD vs. a SATA SSD? We only use the stock encryption tools, Bitlocker. Interesting you asked that because on some of these OptiPlex Micro's, Bitlocker is enabled by default without us setting it that way. Policy requires us to encrypt our laptops and that is done through software provisioning steps after Windows has been installed and gone through OOBE. This isn't the case for desktops. The only other measures take are Secure Boot. That's it.

— Reply to this email directly, view it on GitHubhttps://github.com/rbalsleyMSFT/FFU/issues/6#issuecomment-1837220131, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AMYE2BAIXRK733YQBA4VDLDYHNV5PAVCNFSM6AAAAABACAZ222VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMZXGIZDAMJTGE. You are receiving this because you authored the thread.Message ID: @.***>

jaywatkins commented 11 months ago

The 7060 passed all of its diags, including the extended memory test. Could a BIOS setting be getting in the way? We make several BIOS changes to all of our machines. One of which switches the disk controller from RAID to AHCI.

Thanks again for your help

rbalsleyMSFT commented 11 months ago

It's possible. Could try changing that back or looking at other settings that may have been changed.

Thanks, Richard


From: Jason Watkins @.> Sent: Saturday, December 2, 2023 10:37:50 AM To: rbalsleyMSFT/FFU @.> Cc: Richard Balsley @.>; Author @.> Subject: Re: [rbalsleyMSFT/FFU] "you cannot call a method on a null valued expression." Line 129, character 1 of the script (Issue #6)

The 7060 passed all of its diags, including the extended memory test. Could a BIOS setting be getting in the way? We make several BIOS changes to all of our machines. One of which switches the disk controller from RAID to AHCI.

Thanks again for your help

— Reply to this email directly, view it on GitHubhttps://github.com/rbalsleyMSFT/FFU/issues/6#issuecomment-1837224655, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AMYE2BA3CWC5SRS6USBKK23YHNYP5AVCNFSM6AAAAABACAZ222VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMZXGIZDINRVGU. You are receiving this because you authored the thread.Message ID: @.***>

jaywatkins commented 11 months ago

Richard,

When the disk controller on the 7090 was set to RAID (default), the ApplyFFU script throws the error mentioned above. Setting the controller to AHCI fixes that. Tested on several machines today.

rbalsleyMSFT commented 11 months ago

Thanks for the update, Jay.

You may be able to add storage drivers to PE then and it'll work when configured as RAID.

jaywatkins commented 11 months ago

I guess. I have all of the latest Dell drivers for WinPE as part of the driver set, but maybe there's some missing. We used to unilaterally disable the RAID option back in the Windows 7 days, when we were deploying with Ghost. Starting with Windows 7 and MDT, that setting didn't matter anymore.