Questions tagged [powershell-5.0]

For questions specific to Powershell Version 5

PowerShell 5.0 was re-released to web on February 24, 2016, following an initial release with a severe bug. Key features include OneGet PowerShell cmdlets to support Chocolatey's repository-based package management and extending support for switch management to layer 2 network switches.

125 questions
59
votes
11 answers

Update Powershell through command line

I want to update a machine's Powershell version. Can this be done through the command line? My present need is to update from PS 4 to PS 5 on a Windows server 2012R2. I guess there is no catch-all solution for all Windows versions and all PS…
LosManos
  • 933
  • 2
  • 10
  • 18
55
votes
8 answers

Powershell to delete all files with a certain file extension

I want to scan a directory (there are no subs) and delete any file with an extension of .avi I tried this syntax, but no errors are thrown, and no files are deleted. This is the code I tried get-childitem 'C:\Users\ramrod\Desktop\Firefly' -include…
user2676140
  • 2,135
  • 8
  • 33
  • 50
37
votes
2 answers

How to colorize the Powershell prompt?

I always make my prompt to be this color in my linux Then I can find my input in the black command window. But can we make the same color in my Powershell?
yode
  • 733
14
votes
1 answer

Setting window size and position in PowerShell 5 and 6

Problem: We have a large television we use for presentations, that isn't exactly 1920×1080 px. It's off and I can't control it. What I can control is my windows laptop that I connect to it. I have been looking for ways to get whatever I need…
Bewc
  • 328
10
votes
2 answers

filter outputs using select-string pipes

In bash, if I do the following, I will get all the environment variables with wd in them. env | grep "wd" Now, in Powershell, I know I could do get-childitem env:wd* But I want to pipe to select-string as a more generic approach, in order to…
JL Peyret
  • 884
9
votes
1 answer

What does ${$} mean / do in PowerShell?

While learning PowerShell, I executed the command ${$} by mistake and got an output like this: PS C:\Users\myuser> Get-ChildItem Env: | Out-File -FilePath $home\env.txt PS C:\Users\myuser> ${$} $home\env.txt First I believed it was something like…
Allende
  • 263
  • 1
  • 3
  • 9
7
votes
4 answers

How can I list all members from AD group showing enable and disabled users?

I'm trying get a list of all members from a AD Group showing active \ inactive users. The purpose is get all the members on the groups and list the ones with Admin privileges. I did the following commands: $GROUPNAME = "Domain Admins"…
5
votes
2 answers

Programmatically create machine startup script in local Group Policy: script executes but is not visible in Group Policy Editor

I have managed to programmatically create machine startup Powershell script for Windows 10 Pro and place it in the local Group Policy (see below a powershell script used for creation of startup script). Just to reiterate: I am using local Group…
maoizm
  • 1,154
4
votes
1 answer

PowerShell or plink is eating single quotes inside double quotes

PSVersion 5.1.22621.4391 plink: Release 0.82 I've pored through Properly escape awk command from powershell over plink but one of those programs keeps eating single quotes. Is there any way to run this command through plink? echo "select setting…
RonJohn
  • 403
4
votes
1 answer

Don't want to display WARNING: ACTIONS REQUIRED: while running powershell script

I have written bitlocker code to backup key after old key has been shared with user. My requirement is that don't want to display WARNING: ACTIONS REQUIRED: while running script $BLV = Get-BitLockerVolume -MountPoint "C:" $KeyProt =…
4
votes
1 answer

Run powershell script, as administrator, via batch file with parameter passing

When I run the script, without an administrator, via batch file it passes the parameter, but when I run the script, as an administrator, it does not pass the parameter. I tried the command from the link, but without…
4
votes
5 answers

PowerShell 64-bit hanging on new machine

I recently got a new computer with plenty of horsepower and its works very fast everywhere except PowerShell. Environment: Dell XPS 8930 (i7-8700K, 32GB RAM, 1TB NVMe SSD) Windows 10 Pro with latest updates (1809/10.0.17763) PowerShell…
3
votes
1 answer

Are Classes defined through P/Invoke not allowed to be executed remotely?

To get it out the way: I understand there are different ways to go about this such as Get-ChildItem. So, I have a custom class I'm defining to get rid of some of the overhead PowerShell cmdlets have, as well as some .Net classes. The function will…
Abraham Zinala
  • 205
  • 4
  • 10
3
votes
1 answer

How to get list of CLSIDs along with their associated COM Object names?

Searching for the ways to generate or get the list of CLSIDs, I found this link, that actually does it. But it's rather incomplete in my opinion, the complete list would include CLSIDs with their associated COM Object names, as mentioned in…
3
votes
1 answer

Windows 10 regex. Every occurrence of ci not in the words: associate capacitor cellspacing

Windows 10 64-bit. Powershell 5. Notepad++ v.7 32-bit Regex: Every occurrence of ci not in the words: associate associates associations capacitor cellspacing cig cipher circle circuit circular circumstances cite citi city commercial crucial dcim…
somebadhat
  • 1,240
1
2 3
8 9