10
votes
Accepted
Line wrapping in PowerShell ISE Console?
Unfortunately, ISE does not have this functionality... which is weird given that PowerShell (Non-ISE) does.
Unfortunately - the Windows 10/PowerShell 5 ISE isn't any better. The only possible ...
8
votes
Accepted
How to get current path in powershell into a variable
Here are some ways to do that. basically you just need to expand the path property.
PS C:\WINDOWS\system32> $PWD
Path
----
C:\WINDOWS\system32
PS C:\WINDOWS\system32> $PWD.Path
C:\WINDOWS\...
7
votes
Is there a way to disable script echoing in the PowerShell ISE?
If you just want to make the onscreen output 'cleaner', just add:
cls
at the top of your powershell script. This will clear the output in the console. The script will still be written onscreen ...
6
votes
PowerShell ISE - Is there a keyboard shortcut for commenting out lines or multiple lines
Not elegant but functional...
To Comment
"Block Select" at the start of all the lines by:
AltMouse-Left-Click-Drag
or
AltShift while ↑↓
... then ...
Shift3
To UnComment
"Block ...
5
votes
Difference between Echo and Write-Host in PowerShell ISE
I will try to explain it to you more philosophically than technically.
Write-Host is used to show information in the console. It does not get written into the output stream
echo, which is actually an ...
5
votes
Accepted
In Powershell, what is the difference between -Property and -ExpandProperty?
Intro
You can inspect any object in Powershell by feeding it to Format-List cmdlet:
PS> Get-Date | Format-List
DisplayHint : DateTime
Date : 2018-10-21 0:00:00
Day : 21
DayOfWeek ...
4
votes
Accepted
Reverse search in PowerShell ISE wanted
The solution is to press #, type the partial match of the wanted command and complete by pressing tab.
4
votes
Accepted
How to toggle visibility of console pane or hide it in PowerShell ISE
You can use the menu at the top of the GUI or keyboard shortcuts. Either way, the moment you run any line, that console is the output window, so, you are going to find your self constantly closing it ...
4
votes
Accepted
Getting error when converting string to formatted datetime in powershell "String was not recognized as a valid DateTime"
I had the same issue in the past with various dates returned by the Folder.GetDetailsOf() method. I found the issue to be Unicode formatting characters
PS C:\> $TestFile = 'C:\Users\keith\Music\...
4
votes
Accepted
Windows PowerShell ISE freezes on launch every time - how do I diagnose?
PowerShell ISE was slow attempting to access the recent files list and having the connections repeatedly fail to access a network path that no longer existed. I solved it by deleting this directory:
C:...
3
votes
Accepted
PowerShell ISE - Is there a keyboard shortcut for commenting out lines or multiple lines
I found a solution I like at https://community.idera.com/database-tools/powershell/powertips/b/tips/posts/toggling-comments-in-powershell-ise.
It works for one or many lines, or even within lines. ...
3
votes
Reverse search in PowerShell ISE wanted
To anyone visiting in May 2018 and beyond, Ctrl + R does work in Powershell now
3
votes
Accepted
When changing a password via PowerShell, is there a way to bypass the prompt that asks for the existing password?
Your Set-ADAccountPassword line is missing the -reset parameter.
If you have a look at https://learn.microsoft.com/en-us/powershell/module/activedirectory/set-adaccountpassword?view=windowsserver2022-...
2
votes
Always Run PowerShell ISE As Admin
I came across this many months after the post, but I think my comment is helpful.
@Deadly-Bagel No, the script is just a file so it doesn't "run".
While a script is just a file, it can certainly ...
2
votes
How does one start the Powershell ISE with no file open?
Super old question at this point, but I just piggy-backed off of @Windos to come up with a solution that works for me. Since I use ISE-Steroids, there is a feature to persist open files. I didn't want ...
2
votes
PowerShell ISE - Unexpected Error
Download and install the Insiders edition of Powershell ISE. This is a known issue with ISE in Insider releases of Windows.
Duplicate of:
https://stackoverflow.com/questions/49832619/powershell-ise-...
2
votes
Accepted
Can we use canonical name to filter Computers?
I am not real sure of a use case where one should need to use this property, this way, vs the more commonly use properties, yet, the simple answer is nope.
Of course, there is always...
Clear-Host
...
2
votes
Accepted
Regex: Select and Delete everything that is framed in the comments html tags
Using Notepad++:
Ctrl+H
Find what: (?:\h*<!-- ARTICOL START -->\R|\G)\K(?:(<p class=.*?</p>\R?)|(?:(?!<p class=.*?</p>)[\s\S])+)(?=[\s\S]+<!-- ARTICOL FINAL -->)
Replace ...
2
votes
Difference between Echo and Write-Host in PowerShell ISE
As said, Write-Output A.K.A echo outputs the objects
Sends the specified objects to the next command in the pipeline. If the command is the last command in the pipeline, the objects are displayed in ...
2
votes
Accepted
Echo statement is not working inside ForEach-Object loop unless you use break statement. Why and any alternative to fix this?
Here is a refactor to deal with your use case. with validated results per phase.
Function Rename-UdfFunction
{
[cmdletbinding(SupportsShouldProcess)]
Param
(
[Parameter(Mandatory)][...
2
votes
Accepted
Regex: Put some tags at the beginning of the line, but only those that are framed in a comment html
Ctrl+H
Find what: (?:.*?<!-- ARTICOL START -->|\G).*?</p>\K\h+(?=<p .*?<!-- ARTICOL FINAL -->)
Replace with: \n OR \r\n depending on your platform.
CHECK Wrap around
CHECK ...
2
votes
Accepted
Excluding a specific folder in PowerShell
Add if ($folder -ne 'RejectedTransactionHandler'), so when looping through the folders, it won't copy to the RejectedTransactionHandler folder.
The PowerShell -ne comparison operator returns $true if ...
2
votes
Need Remote computer to grab local files
Instead of Entering PSSession you can create it and store it in variable.
$StagingSession = New-PSSession -ComputerName StagingServer -Credential AdminUser
Then you can use Copy-Item with argument -...
1
vote
PowerShell ISE - Is there a keyboard shortcut for commenting out lines or multiple lines
Old, but I just found this question and found this solution.
Select all the lines you want to comment
Ctrl-H to Replace in Script
Type ^ in 'Find what'
Type # in 'Replace with'
Check the Regular ...
1
vote
Getting error when converting string to formatted datetime in powershell "String was not recognized as a valid DateTime"
Continuing from my comment, btw, you could have just done this as well for formatting.
($mCreated = (Get-Date -Format g).ToString())
# Results
<#
2/16/2021 11:10 AM
#>
($mCreated).GetType() |
...
1
vote
Accepted
Powershell: Fails calling function when run as batch
Code refactored.
Semicolons, like you are using them are not needed in PowerShell. It is a habit brought over from other languages. PowerShell ignores/sees them as code terminators.
So, semicolons ...
1
vote
Return a row if a column has a partial or perfect match with CSV in Powershell
I guess I was formatting -match incorrectly when I tried it, simple solution it turns out...
It's simply $Shoes -match 'Red'
1
vote
Accepted
Finding current open file path in PowerShell ISE
$psISE.CurrentFile.FullPath
Is the path to the file. It can be signed with a command like this:
Set-AuthenticodeSignature $psISE.CurrentFile.FullPath $certificate
ISE won't refresh to show the ...
1
vote
Moving folders based on condition
For completeness, here's a PowerShell version:
$Source = 'C:\Source'
$Dest = 'C:\Destination'
Get-ChildItem $source -filter *.xls | foreach{
$FolderName = $_.Basename.Split('_')[1]
If (!(...
1
vote
Accepted
Moving folders based on condition
For this you'll want to loop through the files with delayed expansion. Unless there are subfolders you also want to pull from, I would avoid the /r flag of for since it's recursive. The main issue is ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
powershell-ise × 75powershell × 60
windows × 7
powershell-5.0 × 7
windows-10 × 6
script × 6
powershell-3.0 × 6
command-line × 5
windows-server-2016 × 3
powershell-4.0 × 3
windows-7 × 2
notepad++ × 2
regex × 2
environment-variables × 2
history × 2
bash × 1
windows-8 × 1
ssh × 1
keyboard-shortcuts × 1
remote-desktop × 1
batch × 1
filesystems × 1
cmd.exe × 1
ip × 1
passwords × 1