Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7620211
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T03:53:05+00:00 2026-05-31T03:53:05+00:00

Take the simple HashTable : $data = @{ First = ‘Justin’; Last = ‘Dearing’;

  • 0

Take the simple HashTable:

$data = @{
    First = 'Justin';
    Last = 'Dearing';
    StartDate = Get-Date '2002-03-23';
}

The key StartDate seems to contain a DateTime.

C:\Users\zippy\Documents> $data.StartDate.GetType().FullName
System.DateTime

However, if I attempt to perform binary serialization on it, I get an exception complaining that PSObject is not serializable.

$ms = New-Object System.IO.MemoryStream
$bf = New-Object System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
$bf.Serialize($ms, $data)
$ms.Close()

Throws:

DocumentsException calling "Serialize" with "2" argument(s): "Type 'System.Management.Automation.PSObject' in Assembly 'System.Management.Automation, Versio
n=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' is not marked as serializable."
At C:\Users\jdearing\AppData\Local\Temp\b8967f99-0a24-41f7-9c97-dad2bc288bd9.ps1:12 char:14
+ $bf.Serialize <<<< ($ms, $data)
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : DotNetMethodException

This message goes away and everything works if I use an explicit cast to [DateTime] like so:

$data = @{
    First = 'Justin';
    Last = 'Dearing';
    StartDate = [DateTime] (Get-Date '2002-03-23');
}

So is Get-Date not really returning a DateTime, or is some other powershell oddity at work here.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T03:53:07+00:00Added an answer on May 31, 2026 at 3:53 am

    Every object in PowerShell is actually wrapped mostly transparently in a PSObject. I say mostly transparently, because there are more than a few bugs in PowerShell that omit to remove the wrapper before leaking the object to another API. This causes all sorts of issues, much like the one you see now. Search connect.microsoft.com/powershell for PSObject wrapper. I believe this is no longer an issue in v3 with the new DLR-based engine.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

take this simple loop while(1) { $data = file_get_contents('randomfiles.img'); $resource = imagecreatefromstring($data); //> do
I'm attempting to do something extremely simple - take the current date and time,
I want to get response from websites that take a simple input, which is
Take a simple OrderDetail table which has a Quantity and UnitPrice for each record.
take this simple code: class A{ public: virtual void foo() = 0; void x(){
Take a simple table like below: Column Headings: || Agent's Name || Time Logged
Take a simple XML file formatted like this: <Lists> <List> <Note/> ... <Note/> </List>
I'm looking for the best way to take a simple input: echo -n Enter
Take a very simple case as an example, say I have this URL: http://www.example.com/65167.html
The program needs to take in a simple string from the user and display

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.