Using $host to Examine the PowerShell Host Interface

Using $host to Examine the PowerShell Host Interface

Start your free week with CBT Nuggets. https://cbt.gg/2LZhF9F

In this video, Trevor Sullivan describes how to use the automatic variable, $host, works and how to use it to build a PowerShell host interface. Terminal user interfaces are useful tools, particularly when working with remote servers that don’t have a GUI available. You can write these terminal tools in a number of languages, Trevor is using PowerShell.

Trevor first prints out the $host variable and digs into the command with Get-Member. He then accesses the RawUI class in the PowerShell SDK to show off the UI properties you can use to build your own interface.

He then uncovers useful methods in the $Host.UI.RawUI class that you can use to create buffers with the SetBufferContents method and move cursors with the CursorPosition property.

Newest training from CBT Nuggets:

🆕 CCNP Enterprise (300-500) | https://courses.cbt.gg/20c

From the CBT Nuggets blog:

• Going Beyond Servers with PowerShell | https://blog.cbt.gg/npa
• 10 Most Common PowerShell Questions for Beginners | https://blog.cbt.gg/3q8
• First Steps to IT Automation with PowerShell | https://blog.cbt.gg/mdf
• Microsoft Office Tips to Make Your Life Easier | https://blog.cbt.gg/rxx
• Why PowerShell is a Great First Language | https://blog.cbt.gg/n2w

Start learning with CBT Nuggets:

• PowerShell | https://courses.cbt.gg/be3
• Building a Practice Lab | https://courses.cbt.gg/kdd
• VMware vSphere 6 | https://courses.cbt.gg/bf0

cbt nuggetsit trainingit jobs

Post a Comment

0 Comments