Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
mpunderw opened this issue Dec 18, 2019 · 3 comments
Open

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

mpunderw opened this issue Dec 18, 2019 · 3 comments

Comments

@mpunderw
Copy link

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

@ThiloL
Copy link

ThiloL commented Jun 8, 2020

Same here. German Windows.

@Misha305
Copy link
Contributor

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.

@hotzenwalder
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants