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
6
votes
1 answer

(Powershell) Catch "Get-WinEvent : No events were found" Get-WinEvent

When I run a below command to list log by ID, it says Get-WinEvent : No events were found that match the specified selection criteria. How can I catch this exception and display a simple message saying "No events found". Command which I…
S R
  • 657
  • 3
  • 10
  • 21
6
votes
1 answer

How to type a tab (indent) in comments in PowerShell ISE?

This is weird. I know tab is for command completion in the PowerShell ISE and fine so. But, it also messes up the editing pane. Do this: File > New (Untitled1.ps1 opens) Press tab (all fine, you get an indent) type enter, # (comment) and press tab…
akauppi
  • 17,018
  • 15
  • 95
  • 120
6
votes
1 answer

Powershell ISE Crashes on Launch

Not sure why, but today my workstation refuses to load the Powershell ISE. I can load Powershell just fine and my cmdlets work. I've tried loading both the 32bit and 64bit ISEs and both crash for the same reason. This is the crashdump: Problem…
Colyn1337
  • 1,655
  • 2
  • 18
  • 27
6
votes
8 answers

How can I search the first line and the last line in a text file?

I need to only search the 1st line and last line in a text file to find a "-" and remove it. How can I do it? I tried select-string, but I don't know to find the 1st and last line and only remove "-" from there. Here is what the text file looks…
Blitzcrank
  • 917
  • 2
  • 10
  • 19
5
votes
5 answers

Why and when to use 32 or 64-bit PowerShell or ISE?

I just got my first 64-bit Windows notebook. Now I'm looking for information when and why to use the 32 or the 64-bit versions of PowerShell or ISE. My first impression is that I better stay with 32 bit, until I understand things better. What I miss…
bernd_k
  • 11,558
  • 7
  • 45
  • 64
5
votes
5 answers

Why doesn't Console in PowerShell ISE use the latest installed version of PowerShell?

I have recently installed PowerShell 6.2. If I start a PowerShell 6 (x64) command prompt and run $PSVersionTable.PSVersion this is the result Major Minor Patch PreReleaseLabel BuildLabel ----- ----- ----- --------------- ---------- 6 2 …
5
votes
3 answers

PowerShell script to display Notification balloon and take action only works in ISE gui, not from commandline

I've seen a bunch of closely related posts so I know i'm not alone, but none have given me the answer I'm looking for. Apologies if this has been asked and answered and I couldn't find it. this script creates a custom notification area balloon,…
5
votes
2 answers

The PowerShell ISE sometimes behaves unpredictably after code changes are made

I'm using the PowerShell ISE (PS version 5.0). If I run this code: Write-Host "This" It outputs: This If I modify the script like this: Write-Host "That" It outputs: That Great. As expected. Now, if I have this code: $Form = New-Object…
rory.ap
  • 34,009
  • 10
  • 83
  • 174
5
votes
2 answers

Iterate over static properties of a class

To access a static method, we use [namespace.ClassName]::MethodName() and for static properties we use [namespace.ClassName]::Property How do I iterate through all the static properties inside this class? $list = [namespace.ClassName] |…
user3469799
  • 219
  • 1
  • 3
  • 12
5
votes
2 answers

Cmdlets not found in command line but available in ISE

I'm trying to create an IIS application and app pool using PowerShell on a Windows Server 2008 R2 VM. The powershell script is as follows: Param( [string] $branchName, [string] $sourceFolder ) if (-NOT ([Security.Principal.WindowsPrincipal]…
Adamon
  • 484
  • 9
  • 21
5
votes
3 answers

Powershell 4.0 Transcript is not capturing output of Write-Host statements

I have created following script(test.ps1) and I am executing it from command line as "powershell .\test.ps1" Write-Host(Start-Transcript -Path "D:\logs.txt") $remoteScript = { Write-Host "Remote Log" } Invoke-Command -ConnectionUri $uri…
5
votes
3 answers

Remove-Item error: Cannot remove item [item path & name]: Access to the path '[item path & name]' is denied

I'm new to PowerShell. I'm trying to automate the deployment of dll components from a folder on a source server to multiple folders on the destination server. This seems like it should be simple enough: copy components from source (deployment)…
The Furious Bear
  • 592
  • 4
  • 16
  • 31
5
votes
2 answers

Powershell ISE caching variable values?

I'm running 64bit Powershell ISE on Windows Server 2008r2. While debugging I set a variable like: $dbName = "db1" I then make the following change $dbName = "db2" I step through the script again and even though the debugger steps over the amended…
Rob Bowman
  • 7,632
  • 22
  • 93
  • 200
5
votes
4 answers

How to Change name of the NetConnectionProfile Using Set-NetConnectionProfile in PowerShell

I Tried Using How to Change name of the NetConnectionProfile Using Set-NetConnectionProfile $Profile=Get-NetConnectionProfile -InterfaceIndex 35 $Profile.Name = "Network1" The Error is "Name" is a ReadOnly property. At line:1…
Kishan
  • 115
  • 2
  • 2
  • 6
5
votes
3 answers

Why does PowerShell ISE hang on this C# program?

If I compile this c# code to an EXE file and run in a Windows command shell it runs fine: outputting the prompt, waiting on the same line for some user input followed by enter, echoing that input. Running in a PowerShell v3 shell it also runs fine.…
Michael Sorens
  • 35,361
  • 26
  • 116
  • 172