Sometimes some code just does not work the same in the console as it does in the ISE. Here is an example. ISE PS C:\> [CHAR]50000 썐 Shell All that we did was asked to display the character associated with the ASCII code 50000. As you can see, the ISE can display it, but the Shell cannot. So what if you need to alter the behavior of your code or just out right exit your code based on if your code is running in the Shell or ISE. Well, here is a little function that you can add to your code. 1 2 3 4 5 Function Test-ISEHost { If (( Get-host ) . Name -like "*ISE*" ) { Write-Output $True } Else { Write-Output $False } } Since I run a lot of my code from the ISE, I am testing to see my code is using the ISE or not. This code will return TRUE if running in the ISE and False otherwise. With this Boolean value, you can make decisions. 1 2 3 4 5 6 7 8 9 1...
Welcome to the blogsite of MCTExpert. I am a Microsoft Certified Trainer. Here you will find the real questions that are asked to me by my students.