Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [powershell-5.0]

For questions specific to Powershell Version 5

0
votes
0answers
23 views

Powershell Display Error

Q: how to change my powershell back into normal? (not for legacy mode) Discription: powershell always open in wrong display mode, and the solution I've searched on web not work. As shown, I can not ...
1
vote
0answers
34 views

Import and merge 2 CSV files using cmdlets in PowerShell [closed]

I am trying to import and merge columns from 2 CSV file into one using Powershell. Please look at my code and advise. I think that it is right, but I am not sure about referencing different columns ...
0
votes
1answer
45 views

Convert Batch to PowerShell Calling Python Scripts

I have a Batch script that calls Python then runs a Python program. Instead of using a Batch script to do that, I would like to use PowerShell. I am not a programmer nor scripter and I have Googled ...
0
votes
1answer
24 views

Editing an RDP session with Notepad and Powershell

This worked for me ls "~\desktop\CMR Desktop.rdp" -recurse | %{ (gc $_ ) -replace "session bpp:i:32", "session bpp:i:24" | set-content $_.FullName -force } Instead of the "-replace" switch which one ...
1
vote
1answer
39 views

Powershell can't see all files in a directory

Im at a loss with this one. I have a script in the Powershell Directory that I cannot see with Powershell. I've navigated to the directory and ran Dir -Force which should show me all files in the ...
0
votes
0answers
26 views

copy-item working for subdirectories only second time script is run

I have a script that I am using to backup files. For some reason, it is only copying the files and dir of the sub-folder the second time the script runs. The error message is "Container cannot ...
0
votes
1answer
43 views

PowerShell 64-bit hanging on new machine

I just got a new computer with plenty of horsepower and its works fast everywhere except PowerShell. Some of the symptoms, which seem to be consistent: Opening PowerShell shows the copyright info ...
1
vote
1answer
43 views

'Get-WindowsFeature -Name Hyper-V' stucked on 20%

I have executed below command : Get-WindowsFeature -Name Hyper-V | Select-Object InstallState It got stucked on 20% I waited for 30 mins but still no response. Any specific reason and how I ...
2
votes
1answer
73 views

Retrieve data from XML file and edit it

Suppose following example: I have an XML file called plants.xml <?xml version="1.0" encoding="utf-8"?> <Plant> <Zone Left="{PRKNG-7}"> <Data key="Bloodroot">...
0
votes
1answer
33 views

PowerShell is missing Import-Certificate

I was trying to install some certificates via PowerShell's Import-Certificate command, which works great on Windows 10. When I ran it on Windows 7, Import-Certificate wasn't found. I downloaded WMF ...
1
vote
2answers
222 views

Why does this Powershell Script create converted images OUTSIDE the Rootfolder?

The following Powershell script is supposed to process all designated images INSIDE the specified Rootfolder. Some of the renamed output images are generated OUTSIDE the Rootfolder. Any Powershell ...
4
votes
1answer
864 views

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)...
0
votes
0answers
121 views

Prevent users from accessing USB Drive while maintaining access for powershell script

I have created a powershell script that maps a USB drive into a specific folder, at the same time remove the regular access path from MY COMPUTER so it does not show there. $usbAccessPath = "PATH\TO\...
0
votes
0answers
69 views

Powershell ISE: Closing a PowerShell Tab does not unlock a dynamically loaded .NET assembly

Please consider the following scenario. Launch Windows Powershell ISE (64 bit) Create a new PowerShell Tab Create a new PS script which loads a custom assembly by invoking [System.Reflection....
1
vote
2answers
2k views

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 ...
1
vote
1answer
136 views

Bug in PowerShell classes when script is in a folder containing a single-quote?

My client's PowerShell scripts aren't working for a new user who happens to have a single-quote in their name - which means their profile path is called "C:\Users\Liam'OReilly". It appears to be a bug ...
2
votes
1answer
393 views

Powershell 6 missing cmdlets

Why are cmdlets like Test-NetConnection no longer available? It appears the entire NetTCPIP module is not in v6. Is there a list of depreciated cmdlets in Powershell Core? Get-Module -n Microsoft....
1
vote
1answer
474 views

Install multiple .cer (certificates) from a network directory using powershell, but first check if they are already installed

I am still learning the ways of powershell, and am having difficulties solving a problem. I would like to have the following logic flow: Go out to \fileserver\certs and pull all thumbprints for each ...
3
votes
1answer
1k views

Configure Windows Update in Windows Server 2016

Problem Enable Windows Update to Automatically download and schedule install. Schedule to run on a particular day (Saturday). Solution I tried Write a powershell script using gpmc/grouppolicy ...
0
votes
1answer
75 views

My script overwrites the previous entry after each “foreach” loop

The script I have here writes out the information I want. However I've noticed that each new valid entry replaces the last. I cannot figure out why. So what I end up with is just 1 entry every time ...
1
vote
2answers
406 views

Out-File does not show all my columns

Get-ADComputer -SearchBase "DC=some,DC=website,DC=net" -Filter * -Properties Name,Created,whenChanged,LastLogonDate,Description,IPv4Address,OperatingSystem,OperatingSystemServicePack,...
0
votes
0answers
45 views

Checking for a file whether it is readable and regular in powershell

I'm new to powershell and I want to check if file in readable and regular. In unix we can do it by using -f & -r. For example the following shell script function accepts filename as argument and ...
-1
votes
3answers
6k views

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 ...
0
votes
0answers
206 views

Error when cleaning Windows recycle-bin with Clear-RecycleBin

I use this to clear the recycle bin of Windows: powershell -command "& {Clear-RecycleBin -force}" or even simpler powershell Clear-RecycleBin -force The command appears to work, but there's an ...
1
vote
1answer
3k views

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 ...
15
votes
1answer
3k views

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?
2
votes
1answer
382 views

Unable to Copy Files in PowerShell using PSSession and Copy-Item cmdlet without a Method Invocation Error

I have a PowerShell script that attempts to transfer files from an old machine to a new one. This is occuring on Windows 10 with PowerShell v5. For this purpose I'd prefer to use PSSession to transfer ...
3
votes
2answers
783 views

PowerShell issue - IF statement curly brackets

I’ve come across something with PS and I don’t know if I’m doing something wrong or maybe it is just a bug in PS (and I can’t find the answer anywhere)? I’ve tested this with PS v4, v5.0 and v5.1 ...
0
votes
1answer
454 views

Unhandled Powershell error on launch

I randomly started getting an unhandled exception when trying to launch powershell x64 this evening. It was working just fine before I put my computer to sleep a few hours ago. Unhandled Exception: ...
1
vote
2answers
145 views

Where-Object not returning any contents

I'm getting started with Windows server 2016, and I'm using a CLI only version. I'm trying to determine what features are installed on my Computer. I tried to do so by viewing stuff with Get-...
0
votes
1answer
428 views

Showing all glyphs in PowerShell

My version is 5.1 but the Lucinda Console font is not able to show the full range of glyphs for most, if not all, Unicode characters. Isn't PowerShell making use of the installed fonts in the Windows ...
1
vote
1answer
335 views

Get HostName for Each RemoteAddress IP in New Member

I have a PowerShell script, which has some variables $GetCon : Get Tcp Connection in Powershell $hn : Get expand Remote-Address in $GetCon. $rrt : is a Number of all results, it's all connection IP's....
1
vote
2answers
197 views

Powershell shows PSModulePath is doubled up

Here is my problem: PS C:\windows\system32> $env:PSModulePath.Replace(';',"`n") C:\Users\sirdank\Documents\WindowsPowerShell\Modules C:\Program Files\WindowsPowerShell\Modules C:\windows\system32\...
6
votes
1answer
4k views

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-...
1
vote
1answer
274 views

Why do I need to escape the last single quote in this Powershell here-string?

According to Powershell "about quoting rules": A here-string is a single-quoted or double-quoted string in which quotation marks are interpreted literally. However the following here-string ...
0
votes
1answer
142 views

How do I filter out a string with a wildcard and output it into another text file with a modification?

I want to uninstall all the third party drivers from a Windows image using DISM but it seems it does not accept wildcards. This means I would have to uninstall them all manually which I want to avoid. ...
1
vote
0answers
428 views

Get-WmiObject throws “Invalid access to memory location.”

I'm trying to run the following PowerShell command under WinPE (Version 10.0.10586.0): Get-WmiObject -Class Win32_ComputerSystem But I get this error: Get-WmiObject : Invalid access to memory ...
0
votes
0answers
392 views

PowerShell change console tab size

Let's say I have a file called test.txt with a tab and some text. I cat the file and on my Windows 10 1511 installation the tab is displayed as 8 spaces. Say I want to change it to 4. How do I change ...
3
votes
2answers
581 views

All of the about_* topics are missing from my PowerShell help. What gives?

I've not used PowerShell often on this machine — it was updated from windows 7 pro to windows 10 a few months ago. $PSVersionTable shows I'm on version 5. I've run update-help as administrator, but ...
0
votes
1answer
639 views

Invoke-WebRequest alterative in PowerShell v5

In previous versions of PowerShell, I used Invoke-WebRequest to download files from HTTP. While using Server 2016 Nano with PowerShell 5.1, I found out that this command has been removed! How am I ...
0
votes
0answers
935 views

Using Workflows In Powershell

I have been using just a standard foreach loop, which executes as it should. However, I have an 8 core processor and 16GB of RAM and thought I would utilize such with a Parallel.foreach loop. Well, ...
8
votes
4answers
20k views

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-...
1
vote
0answers
361 views

“This Update is not applicable to your system”

When trying to install Windows Management Framework 5 on Windows 8.1 I'm getting this error: "This Update is not applicable to your system". According to this article it's due to a dependency on PS 4 ...
3
votes
2answers
373 views

PowerShell v5: Suppress Out-Default output in nested functions

I'd like to suppress any output then function_b is invoked: Function function_a { "test" | Out-Default } function function_b { [CmdletBInding()] param() function_a } # These are ...