Use this tag for version specific questions about Windows PowerShell version 7.0. When using this tag also include the more generic [powershell] tag where possible. For general PowerShell topics, use the [powershell] tag.
Questions tagged [powershell-7.0]
216 questions
1
vote
1 answer
Internal CLR errors (0x80131506) and crash in Powershell
I am going to preface this by saying that the cause of the error itself might not actually be related to PowerShell specifically, it may lie deeper in .NET but that is where I encountered it.
PowerShell version: 7.1.0
I defined the following type in…

Taederias
- 248
- 2
- 10
1
vote
2 answers
PowerShell 7.1, How do I Get Aliases from a List of Functions Names
I'm fairly new to Powershell so I may be missing something, so hear goes:
Note: I prefix all my functions with my initials Function mts_do_something()
I'm trying to walk through a list of Functions ( Get-Command mts_* ) and get their associated…

Mark T. Schwartz
- 15
- 3
1
vote
2 answers
Use the AZ module in a non-interactive environment?
I'm hoping to be able to use the Az module to retrieve a secret from an Azure key vault, for use with a PowerShell script that has been deployed to a server and is run daily by Windows Task Scheduler.
Initially, I needed to follow the oauth (a…

craig
- 25,664
- 27
- 119
- 205
1
vote
1 answer
How to set a counter within ForEach-Object Parallel - PowerShell 7
I have a int variable defined outside the foreach block, trying to set it within the block and access it outside. However, when I run this script, I get below error. It seems to be a basic thing but I am new to PowerShell.
Error : The '++' operator…

user13624867
- 225
- 4
- 14
1
vote
2 answers
Replace files based on extension using Split-Path
Let me start out by saying I am a complete beginner when it comes to this stuff. I am trying to replace a bunch of missing files with a place holder. Problem is there are multiple file types each needing a different place holder file.
I am using…

Rocky R
- 15
- 4
1
vote
0 answers
Capture errors within ForEach-Object -Parallel in Powershell 7
I am trying to execute Powershell script (7.0) file using Powershell 7-Preview which iterates through all the databases, update them using DACPAC file and execute other SQL Server scripts in all the DBs.
It works fine when there is no errors,…

user13624867
- 225
- 4
- 14
1
vote
0 answers
Error on running Pester test using foreach-object -parallel
I have this infrastructure pester test. Code for demonstration purpose:
Describe 'WEB-Tests' {
$servers = 'ServerA','ServerB'
$sessions = @()
foreach ($server in $servers) {
$sessions += New-PSSession -ComputerName $server
}
…

medinibster
- 57
- 2
- 11
1
vote
0 answers
duplicate behavior in powershell
I was just playing around with hash tables and I did this:
$C = @{color = [System.Collections.ArrayList]@(@{y = 'yellow'},@{y = 'blue'})}
and I ended up with finding I can do:
($C.color.y).Get(1) or ($C.color.y).Item(1) and it does exactly the same…

Whitequill Riclo
- 788
- 2
- 8
- 19
1
vote
1 answer
How do I run a PowerShell script on an Azure App Service running Linux?
Using SSH to remote into the App Service I'm greeted with this message:
root@05831a60f815:/home# pwsh
-bash: pwsh: command not found
It would appear that Microsoft's new PowerShell Core is not installed on Azure's Linux containers.
Where do I…

RubbelDieKatz
- 1,134
- 1
- 15
- 32
1
vote
2 answers
Cannot validate argument on parameter 'Username'. The argument is null or empty. Provide an argument that is not null or empty
I am trying to execute Powershell script (7.0) file using Powershell 7-Preview which iterates through all the databases and execute SQL Server script in all the DBs.
The script fetches all the databases correctly, however, when Parallel block…

user13624867
- 225
- 4
- 14
1
vote
1 answer
Blob property - Is there a better way of picking from this collection other than through a ForEach loop?
I have the following code which gets a collection of the properties of a blob and then uses a foreach loop to locate the selected property value. Is there a bettwer that does not involve looping through the collection in PowerShell 7
$Blobs =…

ibexy
- 609
- 3
- 16
- 34
1
vote
1 answer
How do I pipe a byte stream to/from an external command?
Using Get-Content -AsByteStream, one can read file as a byte stream.
Using Set-Content -AsByteStream, one can create a file from a byte stream.
However, I haven't found a way to pass these byte streams to other non-PowerShell commands. Pipes between…

snipsnipsnip
- 2,268
- 2
- 33
- 34
1
vote
1 answer
Functions do not export. PowerShell 7.0.2 on Linux
TL;DR
Running PowerShell 7.0.2 on Linux (Fedora 32), the module loads, but no functions are exported.
Details
I've written a very basic test module on Linux, which won't export any functions. I've tried it on Windows PowerShell and it does work.…

woter324
- 2,608
- 5
- 27
- 47
1
vote
1 answer
How can I get my function to run the Custom Object for the computer Names?
I'm a newcomer to Powershell, and I want to run everything in my Custom Object which $info for all of the computers in $computerName in order to get their information. In this code, I've named them A, B, C for general reference. I tried implementing…

Jojo
- 11
- 1
1
vote
0 answers
How do you add a CIM instance with a key parameter that contains prohibited wildcards?
Note: I'm aware of the Wdac module but it currently does not work from PowerShell 7. Working around that issue led to this question.
The Add method of the MSFT_OdbcDsnTask class has a required parameter "DriverName" whose description reads as…

alx9r
- 3,675
- 4
- 26
- 55