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
                    
                    12
                    
            votes
                
                2 answers
            
        Is anybody having this Powershell "Update-Help" command, issue?
I am trying to download and install Help files for all the commands but it won't work. I am using Powershell 7.1.1 inside the Windows Terminal.
Update-Help: Failed to update Help for the module(s) 'ConfigDefender, PSReadline' with UI culture(s)…
         
    
    
        techsk8
        
- 367
- 4
- 17
                    9
                    
            votes
                
                1 answer
            
        What decides if a value is returned from a PowerShell function?
I'm trying to figure out what dictates if a value is returned from a PowerShell function or not, and I've run into some oddities. The about_return docs say:
In PowerShell, the results of each statement are returned as output, even without a…
         
    
    
        Carcigenicate
        
- 43,494
- 9
- 68
- 117
                    9
                    
            votes
                
                2 answers
            
        skip powershell startup check for new version
tl;dr How to force Powershell to skip checking for a new release?
When I start Powershell 7, it checks for a new version of Powershell.
Currently, this looks like
PowerShell 7.0.0
Copyright (c) Microsoft Corporation. All rights…
         
    
    
        JamesThomasMoon
        
- 6,169
- 7
- 37
- 63
                    9
                    
            votes
                
                1 answer
            
        Pass variables to Foreach-Object PowerShell 7
What I want:
I have a script, which copies CAB-Files to over a hundred Servers, and works with it on them.
This script runs for over a week.
As I learned about the Foreach-Object -parallel Feature, I thought this would speed up the script…
         
    
    
        Sukram22
        
- 93
- 1
- 4
                    7
                    
            votes
                
                1 answer
            
        Write-Information does not appear to work in powershell foreach-object -parallel
I am new to powershell and just learning it.  I have some experience in C#.  I am trying to use the foreach-object -Parallel option but cant get all the Write-* functions to work.
function writeTest {
        1..1 | ForEach-Object -Parallel {
      …
         
    
    
        tcochunk
        
- 83
- 1
- 6
                    6
                    
            votes
                
                2 answers
            
        How to prevent trailing newline in PowerShell script?
This code adds lines, even when using "-NoNewline"
$LST1="OsName","OsVersion","TimeZone","CsName"
$LST2="CsManufacturer","CsModel","CsSystemType","BiosBIOSVersion","BiosReleaseDate"
$MEM1 = (Get-CimInstance Win32_PhysicalMemory | Measure-Object…
         
    
    
        Ed Pollnac
        
- 121
- 1
- 6
                    6
                    
            votes
                
                2 answers
            
        Importing multiple versions of Powershell Modules loads them all?
Importing multiple versions of modules (this is PS7):
Import-Module -Name MyModule -RequiredVersion 1.0.28
Import-Module -Name MyModule -RequiredVersion 1.0.29
Will load both versions into your session:
Get-Module -Name MyModule…
         
    
    
        FBryant87
        
- 4,273
- 2
- 44
- 72
                    5
                    
            votes
                
                1 answer
            
        PowerShell 7. ForEach-Object -Parallel Does Not Autheticate Against Azure PowerShell
We wrote a script that supposed to execute Azure PowerShell commands in parallel. The problem is when we increase -ThrottleLimit higher than one, some of the commands are not being performed properly. The script is:
# Writing IPs for whitelisting…
         
    
    
        WinBoss
        
- 879
- 1
- 17
- 40
                    4
                    
            votes
                
                1 answer
            
        Why is the function not called by Start-ThreadJob?
I want to backup some data over my script. All data shall be zipped in a separate thread. But two things go wrong:
The function testFct is never called - indication: no "inside: ...".
The parameter ZipSource is missing - see output.
Calling the…
         
    
    
        kirsche40
        
- 981
- 1
- 10
- 19
                    4
                    
            votes
                
                1 answer
            
        How to clear a event log in Powershell 7
in Powershell 5 we can clear a Windows-Event-Log in this way:
Get-EventLog -LogName * | % { Clear-EventLog -LogName $_.log }
how to do this in Powershell 7??? (using powershell only)
Powershell way of handling windows events is now with…
         
    
    
        ZEE
        
- 2,931
- 5
- 35
- 47
                    3
                    
            votes
                
                1 answer
            
        Powershell PSReadLine : Get Key's for a given Function?
In PSReadLine  2.2.2 for PowerShell  7.2.11, On Windows, you can also use the Alt+? key chord to show the function bound to the next key chord you enter.
Conversely, is there a key or PS command that will show keys for a given function?
For example,…
         
    
    
        Jason Doyle
        
- 83
- 7
                    3
                    
            votes
                
                1 answer
            
        Implicit conversion to bool of struct defined in C# fails in PowerShell
Why does an implicit conversion to [byte] work, but when replacing byte by bool it no longer works?
I. e. the following works...
Add-Type -TypeDefinition @'
public readonly struct MyByte
{
    private readonly byte value;
    public MyByte( byte b…
         
    
    
        zett42
        
- 25,437
- 3
- 35
- 72
                    3
                    
            votes
                
                1 answer
            
        Use a PowerShell hash's key/values with Pester TestCases
I would like to pass the key/values of a PowerShell hash to a Pester unit test, via the TestCases parameter:
BeforeAll {
  $Expected = @{
    Address1='Address1'
    Address2='Address2'
    City='City'
    RegionCode='RegionCode'
   …
         
    
    
        craig
        
- 25,664
- 27
- 119
- 205
                    3
                    
            votes
                
                1 answer
            
        Download a file, get the status, then execute the file
I've tried invoke-restmethod, new-object and many other methods to achieve what I'm trying to do. Here are the latest two iterations:
$req = Invoke-WebRequest -uri $scripturl -OutFile "$($scriptpath)\fls.core.ps1" 
Write-Host "StatusCode:"…
        user736893
                    3
                    
            votes
                
                1 answer
            
        Why is Powershell output different between 5.1 and Core 7.1.4
I have a block of PowerShell code that runs a command and then massages it and writes it to a text file.
$commandOutput = &"C:\Program Files (x86)\Dell EMC\Unity\Unisphere CLI\uemcli" -d $frame -noHeader /stor/config/pool/sr show
foreach ($idline in…
         
    
    
        Andrew Madsen
        
- 155
- 1
- 12