Questions tagged [powershell-ise]

PowerShell-ISE refers to Microsoft Windows PowerShell's Integrated Scripting Environment.

PowerShell-ISE refers to Windows PowerShell's Integrated Scripting Environment. The ISE offers the features of the PowerShell console plus script editing and debugging features. ISE is also unicode aware, vs the Console that isn't!

522 questions
511
votes
13 answers

Create directory if it does not exist

I am writing a PowerShell script to create several directories if they do not exist. The filesystem looks similar to…
ecollis6
  • 5,357
  • 4
  • 17
  • 12
258
votes
6 answers

Reload the path in PowerShell

If I have an instance of PowerShell ISE running and I install something that modifies the PATH or I modify it in any way outside of PowerShell then I need to restart PowerShell for it to see the updated PATH variable. Is there a way to reload the…
rob
  • 17,995
  • 12
  • 69
  • 94
180
votes
5 answers

Read file line by line in PowerShell

I want to read a file line by line in PowerShell. Specifically, I want to loop through the file, store each line in a variable in the loop, and do some processing on the line. I know the Bash equivalent: while read line do if [[ $line =~ $regex…
Kingamere
  • 9,496
  • 23
  • 71
  • 110
88
votes
6 answers

How to pass needed parameters to script in Powershell ISE?

See Title. I specified needed parameters in the head of a script: param ($G_ARCHIVE = $(throw "Need file to upload!"), $G_LOGFILE = $(throw "Need logfile!")) When I want to debug the script with Powershell ISE: how can I fill these…
eckes
  • 64,417
  • 29
  • 168
  • 201
76
votes
2 answers

Get relative path of files in sub-folders from the current directory

Is there any straight-forward way (by use of cmdlets or .NET classes) to obtain only the relative path of a file in a sub-folder from a given path? eg current folder is C:\MyScript and there is a sub-folder called Data with a file Test.txt, so I…
blue18hutthutt
  • 3,191
  • 5
  • 34
  • 57
58
votes
5 answers

Passing a variable to a powershell script via command line

I am new to powershell, and trying to teach myself the basics. I need to write a ps script to parse a file, which has not been too difficult. Now I want to change it to pass a variable to the script. that variable will be the parsing string. Now,…
cquadrini
  • 769
  • 2
  • 12
  • 25
25
votes
2 answers

Is it possible to reset the runspace in Powershell ISE?

One of the features of PowerGUI is the ability to reset the Powershell Runspace as demonstrated in this article and this article. Is it possible to do this in PowerShell ISE?
Justin Dearing
  • 14,270
  • 22
  • 88
  • 161
19
votes
2 answers

PowerShell ISE: how to run new PowerShell version

How can I get PowerShell ISE to work with PowerShell 6.0. Currently, it has 4.0. This server has PowerShell 4.0 installed and I installed PowerShell 6.0 with PowerShell-6.1.0-win-x64.msi from this link:…
Conrad S.
  • 774
  • 4
  • 10
  • 19
18
votes
2 answers

PowerShell changes return object's type

I am using PowerShell v3 and the Windows PowerShell ISE. I have the following function that works fine: function Get-XmlNode([xml]$XmlDocument, [string]$NodePath, [string]$NamespaceURI = "", [string]$NodeSeparatorCharacter = '.') { # If a…
deadlydog
  • 22,611
  • 14
  • 112
  • 118
18
votes
4 answers

Powershell: $LASTEXITCODE in a function

Hi I'm noticing some odd behavior with the following code snippet function test { $LASTEXITCODE = $null ping asdfs Write-Host "Last exitcode: $LASTEXITCODE" } test Write-Host "Last exitcode: $LASTEXITCODE" The output from this is Ping…
blue18hutthutt
  • 3,191
  • 5
  • 34
  • 57
16
votes
1 answer

PowerShell - Setting $ErrorActionPreference for the entire script

I've been giving PowerShell (v3.0) a shot for the first time today, and became enormously frustrated with the strange way some of its error-handling concepts are implemented. I wrote the following piece of code (using the Remote Registry PowerShell…
romatthe
  • 1,447
  • 3
  • 17
  • 33
15
votes
4 answers

PowerShell ISE throws an error on git checkout

In PowerShell, git checkout runs without any error message. In the ISE, while git checkout stills works, the ISE gives an error message. > git checkout master Your branch is ahead of 'origin/master' by 3 commits. (use "git push" to publish your…
Shaun Luttin
  • 133,272
  • 81
  • 405
  • 467
14
votes
5 answers

Why won't PowerShell ISE let me set breakpoints when running as Administrator?

Having failed to get PowerGUI to work properly I've fallen back on PowerShell ISE. However if I run this as Administrator it won't let me set any breakpoints. If I launch as normal (my login is a member of Administrators) all is well but because I…
Kev
  • 118,037
  • 53
  • 300
  • 385
14
votes
2 answers

Search on an Internet Explorer App Object

I have a InternetExplorer.Application I am creating an automation and one of the pages I opened, opened a dialog that looks like a new tab, but on the same process (I checked it by the task manager >> process tab that the same process just consumes…
Asaf Shazar
  • 1,065
  • 1
  • 11
  • 33
14
votes
1 answer

Windows Forms look different in Powershell and Powershell ISE. Why?

I have written a script which is basically a small wysiwyg signature generator for Outlook. We want our signatures to be in corporate colours, and semi-standardised - hence the requirement for this. I did the development work in Powershell ISE and…
Ben
  • 4,281
  • 8
  • 62
  • 103
1
2 3
34 35