OSDBuilder
OSDBuilder copied to clipboard
Get-Date : Cannot bind parameter 'Date' to the target.
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
Same here. German Windows.
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.
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.