Run Selection in Powershell studio

Ask your PowerShell-related questions, including questions on cmdlet development!
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Posts: 1
Last visit: Sat Feb 20, 2021 6:36 am

Run Selection in Powershell studio

Post by paulkantor »


I am fairly new to powershell scripting. With that said, I have a script that creates a CNAME record in dns. The script runs fine when clicking the 'Run' button in Powershell Studio 2020. I added this script to a larger config script, and now the script fails. After doing some troubleshooting, I found that this section runs fine in PS 2020 if I highlight the create CNAME code and right click "Run Selection", but fails if I select "Run Selection in Console.
Any Idea what I am doing wrong?

Any guidance would be appreciated!

Posts: 14704
Last visit: Sat Feb 27, 2021 5:46 am
Answers: 8
Has voted: 2 times
Been upvoted: 6 times

Re: Run Selection in Powershell studio

Post by jvierra »

There is absolutely no way to answer your question. I can on,.y recommend running this in debug mode and stepping through your code to see what is happening.

I can also recommend starting with the following free book which will help you understand how PowerShell code works and how to run and debug PowerShell code. ... werShell-4

Good luck and post back when you have more information.