Quantcast
Channel: Hey, Scripting Guy! Blog
Viewing all articles
Browse latest Browse all 3333

PowerTip: Find Name of PowerShell Host

$
0
0

Summary: Learn to find the name of the Windows PowerShell host.

Hey, Scripting Guy! Question How can I determine if I am running a Windows PowerShell script in the Windows PowerShell console?

Hey, Scripting Guy! Answer Use the Get-Host cmdlet. Here is how to check:

  if((Get-Host).name -ne "consolehost") {"Take appropriate action here"}


Viewing all articles
Browse latest Browse all 3333

Trending Articles