OSDBuilder icon indicating copy to clipboard operation
OSDBuilder copied to clipboard

Get-Date : Cannot bind parameter 'Date' to the target.

Open mpunderw opened this issue 5 years ago • 3 comments

When I run Update-OSMedia I get:

Update-OSMedia PROCESS Get-Date : Cannot bind parameter 'Date' to the target. Exception setting "Date": "Cannot convert null to type "System.DateTime"." At C:\Program Files\WindowsPowerShell\Modules\OSDBuilder\19.12.10.1\Public\Get-OSMedia.ps1:181 char:45

  • ... SMFamilyV1 = $(Get-Date -Date $($XmlWindowsImage.CreatedTime)).ToStri ...
  •                               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : WriteError: (:) [Get-Date], ParameterBindingException
    • FullyQualifiedErrorId : ParameterBindingFailed,Microsoft.PowerShell.Commands.GetDateCommand

You cannot call a method on a null-valued expression. At C:\Program Files\WindowsPowerShell\Modules\OSDBuilder\19.12.10.1\Public\Get-OSMedia.ps1:181 char:47

  • ... OSMFamilyV1 = $(Get-Date -Date $($XmlWindowsImage.CreatedTime)).ToStr ...
  •                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (:) [], RuntimeException
    • FullyQualifiedErrorId : InvokeMethodOnNull

Cannot convert null to type "System.DateTime". At C:\Program Files\WindowsPowerShell\Modules\OSDBuilder\19.12.10.1\Public\Get-OSMedia.ps1:231 char:13

  •         $ObjectProperties = @{
    
  •         ~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidArgument: (:) [], RuntimeException
    • FullyQualifiedErrorId : nullToObjectInvalidCast

This is on Server 2019 that is fully update to date. This has happened on different versions of OSDBuilder, going back at least several months, probably to this summer. I don't believe there is any issue with the actual update process.

PowerShell version:

Name Value


PSVersion 5.1.17763.771 PSEdition Desktop PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...} BuildVersion 10.0.17763.771 CLRVersion 4.0.30319.42000 WSManStackVersion 3.0 PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1

mpunderw avatar Dec 18 '19 18:12 mpunderw

Same here. German Windows.

ThiloL avatar Jun 08 '20 13:06 ThiloL

I got a similar error due to running out of space on the machine I was building. I would check for an earlier error because this is basically saying $XmlWindowsImage.CreatedTime is null. In my case the mounting or extract failed and so the createdtime property was null.

Misha305 avatar Jun 15 '20 23:06 Misha305

I ran into this error because in my \OSDBuilder\OSMedia folder there was a folder with the wrong naming convention Normally when a build is finished a folder is renamed to something like \OSDBuilder\OSMedia\Windows 10 Enterprise x64 1909 18363.1679 nl-NL, but if the proces is interupted you end up with a folder called \OSDBuilder\OSMedia\build2107150900. If such a folder is present you can run into this error. If you remove such a folder in my case the issue went away.

image

hotzenwalder avatar Jul 15 '21 07:07 hotzenwalder