Saturday, 25 June 2016

PowerShell Basics for Dummies - ConvertTo-Html

PowerShell Basics for Dummies - ConvertTo-Html


ConvertTo-Html:

  • Converts Microsoft .NET Framework objects into HTML that can be displayed in a Web browser.
  • The ConvertTo-Html cmdlet converts .NET Framework objects into HTML that can be displayed in a Web browser. You can use this cmdlet to display the output of a command in a Web page.
  • You can use the parameters of ConvertTo-Html to select object properties, to specify a table or list format, to specify the HTML page title, to add text before and after the object, and to return only the table or list fragment, instead of a strict DTD page.
  • When you submit multiple objects to ConvertTo-Html, Windows PowerShell creates the table (or list) based on the properties of the first object that you submit. If the remaining objects do not have one of the specified properties, the property value of that object is an empty cell. If the remaining objects have additional properties, those property values are not included in the file.

Get-EventLog -LogName "Windows PowerShell" | ConvertTo-Html > PSEventlog.htm

  • The command sends the HTML code to the PSEventlog.htm file.

No comments:

Post a Comment