November 23rd, 2015

PowerTip: Use PowerShell to Generate Object with Two Property Types

Doctor Scripto
Scripter

Summary: Use Windows PowerShell to generate an object with two property types.

Hey, Scripting Guy! Question How can I use Windows PowerShell to generate an object with two property types from simply splitting a string?

Hey, Scripting Guy! Answer Use the ConvertFrom-String cmdlet to pipe a string, and then specify the desired property types, for example:

PS C:\>“123 456” | ConvertFrom-String –PropertyType String,Int

 

Category
Scripting

Author

The "Scripting Guys" is a historical title passed from scripter to scripter. The current revision has morphed into our good friend Doctor Scripto who has been with us since the very beginning.

0 comments

Discussion are closed.