LinkID= 113207TopicTitle NoteProperty System.String ToString()LinkID NoteProperty System.String Create a custom object using a CSV file: PS C:\> Get-Content.The resulting object has MoreData and State properties, as shown in the command output. The seventh command displays the object in the $J variable. The results are stored in the $J variable. The command uses the Header parameter to submit the alternate header. The sixth command uses the Import-Csv cmdlet to import the Jobs.csv file and convert the CSV strings into a CSV version of the job object. The next three commands delete the original header (the second line) from the Jobs.csv file. Unlike the default header, this header uses MoreData instead of HasMoreData and State instead of JobStateInfo. The second command saves a header in the $Header variable. A pipeline operator (|) sends the resulting job object to the Export-Csv cmdlet, which converts the job object to CSV format. The first command uses the Start-Job cmdlet to start a background job that runs a Get-Process command on the local computer. This example shows how to use the Header parameter of Import-Csv to change the names of properties in the resulting imported object. PS C:\> $J = Import-Csv jobs.csv -Header $Headerįinished : PS C:\> $Header = "MoreData", "StatusMessage", "Location", "Command", "State", "Finished", "InstanceId", "SessionId", "Name", "ChildJobs", "Output", "Error", "Progress", "Verbose", "Debug", "Warning", "StateChanged" # Delete header from file Import-Csv ] ] [ -Encoding | Export-Csv jobs.csv
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |