PowerShell

The PowerShell forum accepts bug reports as well as feedback and suggestions. For more information, check out the PowerShell Homepage

The following is a list of the states we use to track items.

status meaning
survey We saw this and we are considering it. Please upvote if it’s important to you.
needs more information We don’t understand the issue and need additional details.
investigating We are looking at this internally to understand things like: scenario, reproduction of issue, costing, or other technical details.
in queue The issue is understood and in our unprioritized backlog. Your votes will be used to drive prioritization of this work.

Please feel free to provide feedback or file bugs here.

(thinking…)

Enter your idea and we'll search to see if someone has already suggested it.

If a similar idea already exists, you can support and comment on it.

If it doesn't exist, you can post your idea so others can support it.

Enter your idea and we'll search to see if someone has already suggested it.

  • Hot ideas
  • Top ideas
  • New ideas
  • My feedback
  1. Bug: Ps1 script file with extra extension gets deleted when called from CMD

    When calling PowerShell from CMD and specifying a script file that contains an extra "extension" (extra dot) in the base name, the script is not run but the file is mysteriously deleted:

    Example (run in CMD):

    powershell -file c:\temp\script.txt.ps1

    The same issue when called like this:

    powershell -command "& c:\temp\script.txt.ps1"

    This has been reproduced by me and others on different machines with different paths.

    The same issue exists when called from inside PowerShell like this:

    . "powershell.exe" -file c:\temp\script.txt.ps1
    Start-Process "powershell" -Arg "-file, "c:\temp\script.txt.ps1"

    Note that these will work just fine:

    powershell -command "& 'c:\temp\script.txt.ps1'"
    powershell -command ";& c:\temp\script.txt.ps1"
    powershell…

    1 vote
    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      Signed in as (Sign out)

      We’ll send you updates on this idea

      0 comments  ·  Other PowerShell  ·  Flag idea as inappropriate…  ·  Admin →
    • Provide PowerShell module to manage Local Security Policy

      We've now got the the DSC modules for this, but a standalone module for use outside of DSC would be extremely useful

      0 votes
      Sign in
      Check!
      (thinking…)
      Reset
      or sign in with
      • facebook
      • google
        Password icon
        Signed in as (Sign out)

        We’ll send you updates on this idea

        0 comments  ·  Microsoft.PowerShell.* Modules  ·  Flag idea as inappropriate…  ·  Admin →
      • Mount-DiskImage fails with: "Access is denied" 0x5 occurred while reading the console output buffer

        After upgrade from Windows 1803 to Windows 1809 `Mount-DiskImage $iso_path` starts failing with the following error:

        ```
        Exception calling "EndProcessing" with "0" argument(s): "Win32 internal error "Access is denied" 0x5 occurred while reading the console output buffer. Contact Microsoft Customer Support Services."
        At line:352 char:17
        + $__cmdletization_objectModelWrapper.EndProcessing()
        + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo : NotSpecified: (:) [], ParentContainsErrorRecordException
        + FullyQualifiedErrorId : HostException

        ```

        The powershell command is executed under Administrator user in packer. It actually mounts specified image path, but throws this exception on attempt to interact with stdout.

        0 votes
        Sign in
        Check!
        (thinking…)
        Reset
        or sign in with
        • facebook
        • google
          Password icon
          Signed in as (Sign out)

          We’ll send you updates on this idea

          0 comments  ·  PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →
        • high CPU

          Found out when my CPU is high (99%-100) (i do set executionpolicy to remotesign/unrestricted also)
          When i run the PS script, it will ask for executionpolicy.
          but when i low CPU, it will just run the script.

          suspect value (executionpolicy remotesign) unable to pass thru to script.ps1 on time. so it prompt out everytime when CPU is high.
          do we have some setting to tune this. delay it, so that executionpolicy have more time to pass the value to script.ps1.

          ---------------------------------
          Script:
          $sourcefolder="D:\A743"
          $datenow = get-date
          $processdate = (get-date).Adddays(-3)

          get-childitem $sourcefolder -file | where-object { $_.lastwritetime -le $processdate } |…

          1 vote
          Sign in
          Check!
          (thinking…)
          Reset
          or sign in with
          • facebook
          • google
            Password icon
            Signed in as (Sign out)

            We’ll send you updates on this idea

            0 comments  ·  Other PowerShell  ·  Flag idea as inappropriate…  ·  Admin →
          • BUG: Shell crashing with x509Certificate2 objects

            Problem:

            When creating an object from the x509Certificate class the shell adds 3 script properties:

            DnsNameList
            EnhancedKeyUsageList
            SendAsTrustedIssuer

            The SendAsTrustedIssuer property causes Powershell to hit a CLR exception and hard crash when accessed.

            Repro Code:

            * Note: do this in a fresh session as it will crash the session

            $Test = New-Object System.Security.Cryptography.x509Certificates.x509Certificate2
            $Test | select *

            Alternately,

            $Test = New-Object System.Security.Cryptography.x509Certificates.x509Certificate2
            $Test.SendAsTrustedIssuer

            Crash dump:

            Unhandled Exception: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
            at System.Management.Automation.Security.NativeMethods.CertGetCertificateContextProperty(IntPtr pCertContext, CertPropertyId dwPropId, IntPtr pvData, Int32& pcbData)
            at Microsoft.PowerShell.Commands.SendAsTrustedIssuerProperty.ReadSendAsTrustedIssuerProperty(X509Certificate2 cert)
            at CallSite.Target(Closure ,…

            3 votes
            Sign in
            Check!
            (thinking…)
            Reset
            or sign in with
            • facebook
            • google
              Password icon
              Signed in as (Sign out)

              We’ll send you updates on this idea

              0 comments  ·  PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →
            • Remote Invoke-Command with -ScriptBlock changes types of arguments if scripblock contains variables

              What's going on here???

              PS C:\> Invoke-Command -ComputerName somemachine -Credential $cred -ArgumentList {Write-Host hi} -ScriptBlock {param($sb); Write-Host $sb.GetType().Name}
              ScriptBlock
              PS C:\> Invoke-Command -ComputerName somemachine -Credential $cred -ArgumentList {Write-Host hi} -ScriptBlock {param($sb); Write-Host $sb.GetType().Name; $a=3}
              String
              PS C:\> Invoke-Command -ComputerName somemachine -Credential $cred -ArgumentList {Get-ChildItem} -ScriptBlock {param($sb); Write-Host $sb.GetType().Name}
              ScriptBlock
              PS C:\> Invoke-Command -ComputerName somemachine -Credential $cred -ArgumentList {Get-ChildItem} -ScriptBlock {param($sb); Write-Host $sb.GetType().Name; $a=3}
              String

              1 vote
              Sign in
              Check!
              (thinking…)
              Reset
              or sign in with
              • facebook
              • google
                Password icon
                Signed in as (Sign out)

                We’ll send you updates on this idea

                5 comments  ·  PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →
              • Kill a specific IIS request

                Sometimes there are single requests which are hanging in IIS.
                It would be good to kill such a single request without killing the whole process because that can cause a lot of time until a big web application is running again.

                1 vote
                Sign in
                Check!
                (thinking…)
                Reset
                or sign in with
                • facebook
                • google
                  Password icon
                  Signed in as (Sign out)

                  We’ll send you updates on this idea

                  0 comments  ·  Other PowerShell  ·  Flag idea as inappropriate…  ·  Admin →
                • Bug: Powershell Get-Help does not work with Exchange Online cmdlets

                  We've been lucky, from what I'm gathering from web searches! Until December last year, Exchange Online Powershell cmdlet help was available using Get-Help in the shell. However, after the Christmas break, the only response we get is:

                  Get-Help : Exception calling "Invoke" with "0" argument(s): "Cannot find path '' because it does
                  not exist."
                  At line:1 char:1
                  + Get-Help Get-Mailbox
                  + ~~~~~~~~~~~~~~~~~~~~~~~~~~~
                  + CategoryInfo : NotSpecified: (:) [Get-Help], MethodInvocationException
                  + FullyQualifiedErrorId : CmdletInvocationException

                  It's the same issue irrespective of the cmdlet.

                  Consequently, I'm forced to contend with painful searches of the documentation website for information of the relevant cmdlets.

                  Raised…

                  2 votes
                  Sign in
                  Check!
                  (thinking…)
                  Reset
                  or sign in with
                  • facebook
                  • google
                    Password icon
                    Signed in as (Sign out)

                    We’ll send you updates on this idea

                    0 comments  ·  Other PowerShell  ·  Flag idea as inappropriate…  ·  Admin →
                  • SMTPEventConsumer doesnt format message body properly

                    I found a bug in PS 4.0 when working with SMTPEventConsumers. The bug I found truncated the string used for the "Message" property of the SMTPEventConsumer. The code truncated anything after the first 16 characters. It didn't matter what I used for an escape sequence, formatted as here string, nothing worked. I ran the exact same code on a PS 5.1 host and the SMTP message was formatted exactly as expected. For more indepth info I have included a link to the thread I started on TechNet for this issue.

                    https://social.technet.microsoft.com/Forums/en-US/62c4552b-b5e8-4bf3-ac74-6c5f1668af9f/issues-properly-formatting-smtpeventconsumer-message-body-in-powershell?forum=ITCG

                    1 vote
                    Sign in
                    Check!
                    (thinking…)
                    Reset
                    or sign in with
                    • facebook
                    • google
                      Password icon
                      Signed in as (Sign out)

                      We’ll send you updates on this idea

                      0 comments  ·  PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →
                    • BUG: Get-Help <word> doesn't search content of about_* files unless -Category HelpFiles parameter is specified

                      The help text for the -Name parameter of Get-Help says:
                      "...If you enter a word that does not match any help topic titles, Get-Help displays a list of topics that include that word in their contents."

                      Example:
                      PS> Get-Help exit

                      Only returned two cmdlets that have the word 'exit' in their name.

                      PS> Get-Help exit -Category HelpFile

                      Returns about_* topics where the word 'exit' is found.

                      1 vote
                      Sign in
                      Check!
                      (thinking…)
                      Reset
                      or sign in with
                      • facebook
                      • google
                        Password icon
                        Signed in as (Sign out)

                        We’ll send you updates on this idea

                        0 comments  ·  Microsoft.PowerShell.* Modules  ·  Flag idea as inappropriate…  ·  Admin →
                      • Transfer $DebugPreference and $VerbosePreference to New-PSSession

                        I want a PSSessionOption that says to transfer over common applicable session level variables over to the remote session, specifically $DebugPreference and $VerbosePreference.
                        $DebugPreference = 'continue'
                        $PSSession = New-PSSession -ComputerName 'localhost'
                        Write-Debug $DebugPreference # Writes 'continue'
                        Invoke-Command -ScriptBlock {Write-Debug $DebugPreference} -Session $PSSession # Writes nothing

                        1 vote
                        Sign in
                        Check!
                        (thinking…)
                        Reset
                        or sign in with
                        • facebook
                        • google
                          Password icon
                          Signed in as (Sign out)

                          We’ll send you updates on this idea

                          0 comments  ·  PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →
                        • issue with encrypted mofs on a pull server [partialconfigs]

                          i have a pull server with 2 non-encrypted mofs, and 1 encrypted mof. The LCM on the lab node is configured to pull the 3 different configs as partialconfigs. When I run Start-DSCConfiguration, the encrypted mof fails with the following:

                          PowerShell DSC resource MSFT_UserResource failed to execute Set-TargetResource functionality with error message: There could be a possible multiple matches exception while trying to use the System.DirectoryServices API's.Exception calling "Save" with "0" argument(s): "The
                          password does not meet the password policy requirements. Check the minimum password length, password complexity and password history requirements.
                          "
                          + CategoryInfo : InvalidOperation: (:) [], CimException …

                          1 vote
                          Sign in
                          Check!
                          (thinking…)
                          Reset
                          or sign in with
                          • facebook
                          • google
                            Password icon
                            Signed in as (Sign out)

                            We’ll send you updates on this idea

                            0 comments  ·  Desired State Configuration (DSC)  ·  Flag idea as inappropriate…  ·  Admin →
                          • BUG: Get-RDSessionCollection always generates exception on Windows Server 2019

                            Get-RDSessionCollection of the RemoteDesktop module always throws an exception:
                            --

                            PS C:\windows\system32> Get-RDSessionCollection
                            New-Object : Exception calling ".ctor" with "1" argument(s): "Invalid parameter "
                            At C:\windows\system32\WindowsPowerShell\v1.0\Modules\RemoteDesktop\SessionDesktopCollection.psm1:520 char:14
                            + ... $scope = New-Object System.Management.ManagementScope("\\" + $Conn ...
                            + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                            + CategoryInfo : InvalidOperation: (:) [New-Object], MethodInvocationException
                            + FullyQualifiedErrorId : ConstructorInvokedThrowException,Microsoft.PowerShell.Commands.NewObjectCommand

                            CollectionName Size ResourceType CollectionType CollectionDescription
                            -------------- ---- ------------ -------------- ---------------------
                            mycollection 0 RemoteApp programs PooledUnmanaged My first collection

                            PS C:\windows\system32>

                            --

                            Changing C:\Windows\System32\WindowsPowerShell\v1.0\Modules\RemoteDesktop\SessionDesktopCollection.psm1 line 520

                            $scope = New-Object System.Management.ManagementScope("\\" + $ConnectionBroker + "\" + $wmiNamespace, $connectionOptions)

                            into

                            $msuri = "\\" + $ConnectionBroker + "\" + $wmiNamespace
                            $scope = New-Object System.Management.ManagementScope($msuri, $connectionOptions)

                            1 vote
                            Sign in
                            Check!
                            (thinking…)
                            Reset
                            or sign in with
                            • facebook
                            • google
                              Password icon
                              Signed in as (Sign out)

                              We’ll send you updates on this idea

                              0 comments  ·  Microsoft.PowerShell.* Modules  ·  Flag idea as inappropriate…  ·  Admin →
                            • Get-Help NOTES section identation issue

                              When we run get-help on cmdlet which has .NOTES the output is unusually indented, even though there is no tab in function documentation.

                              2 votes
                              Sign in
                              Check!
                              (thinking…)
                              Reset
                              or sign in with
                              • facebook
                              • google
                                Password icon
                                Signed in as (Sign out)

                                We’ll send you updates on this idea

                                0 comments  ·  Documentation  ·  Flag idea as inappropriate…  ·  Admin →
                              • Broken or Incorrect Powershell on Windows 10

                                So I have Windows 10, in Windows optionalFeatures.exe Powershell is marked as version 2.0 in windows system32 is it version 1.0 and Windows Powershell HOST command says Version 5.1

                                Despite the above information, my Powershell does not know how to do any commands such as 'install-module' or 'PSVerstonTable'
                                I have a suspicion that my Powershell is somehow corrupted or the incorrect version that was manually installed previously.

                                I have turned Windows PowerShell 2.0 OFF in Windows Features but Powershell remains and I can open and access it.

                                I have looked for guides and help on how to do a clean…

                                1 vote
                                Sign in
                                Check!
                                (thinking…)
                                Reset
                                or sign in with
                                • facebook
                                • google
                                  Password icon
                                  Signed in as (Sign out)

                                  We’ll send you updates on this idea

                                  0 comments  ·  Other PowerShell  ·  Flag idea as inappropriate…  ·  Admin →
                                • Bug in Import-StartLayout cmdlet

                                  The documentation states to import a .xml to a mounted Windows image, you can use the powershell command:
                                  PS C:\ Import-StartLayout -LayoutPath "Layout.xml" -MountPath "E:\MountedImage"

                                  This will generate an error. You cannot end -MountPath with a '' character, if you do, PowerShell throws the error:
                                  Import-StartLayout : The path B:\WIMs\Test\ did not resolve to a file.

                                  If you format the command:
                                  PS C:\ Import-StartLayout -LayoutPath "Layout.xml" -MountPath "E:\MountedImage"
                                  You will receive the following error:
                                  Import-StartLayout : Could not find a part of the path
                                  'E:\MountedImageUsers\Default\AppData\Local\Microsoft\Windows\Shell\LayoutModification.xml'.
                                  Note the missing '\' character between "MountedImage" and "Users"
                                  This appears to be an error…

                                  1 vote
                                  Sign in
                                  Check!
                                  (thinking…)
                                  Reset
                                  or sign in with
                                  • facebook
                                  • google
                                    Password icon
                                    Signed in as (Sign out)

                                    We’ll send you updates on this idea

                                    0 comments  ·  Microsoft.PowerShell.* Modules  ·  Flag idea as inappropriate…  ·  Admin →
                                  • Move-AzureRmDataLakeStoreItem not working in newer versions of module

                                    I created a runbook on several automation accounts that move around files and folders on Datalake Storage Accounts (gen 1). The runbook works without hitches on 2 automation accounts, but did not work on the other 2.

                                    There were quite a few differences in the versions of the added modules: the runbook worked on the older versions of the modules, but not the newer. Specifically the cmdlet Move-AzureRmDataLakeStoreItem threw an error on the newer versions:
                                    "Account name ***.azuredatalakestore.net/ is invalid. Specify the full account including the domain name."

                                    After trying quite a few iterations of writing the account name (just…

                                    2 votes
                                    Sign in
                                    Check!
                                    (thinking…)
                                    Reset
                                    or sign in with
                                    • facebook
                                    • google
                                      Password icon
                                      Signed in as (Sign out)

                                      We’ll send you updates on this idea

                                      0 comments  ·  PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →
                                    • Add a -BreakawayFromJob parameter to the Start-Process cmdlet

                                      When you create a process with Start-Process, it joins the same Windows Job as the PowerShell session. There are times when you want to create a process that is in a new Windows Job. The CreateProcess API has a CREATE_BREAKAWAY_FROM_JOB process creation flag which does this.

                                      Please add a -BreakawayFromJob switch parameter to Start-Process which can be used to set this process creation flag.

                                      1 vote
                                      Sign in
                                      Check!
                                      (thinking…)
                                      Reset
                                      or sign in with
                                      • facebook
                                      • google
                                        Password icon
                                        Signed in as (Sign out)

                                        We’ll send you updates on this idea

                                        0 comments  ·  Other PowerShell  ·  Flag idea as inappropriate…  ·  Admin →
                                      • Missing newer computer account in Get-LocalUser on a DC

                                        in PowerShell 5.1.14393.2608 when I run Get-LocalUser * on a Windows Server 2016 Domain Controller I should get a list of all domain user and computer. But the newest Domain joined computer is missing.
                                        Please fix this.
                                        Also when I run Get-LocalUser MyComputer$ and MyComputer is the last domain joined computer I get ObjectNotFound

                                        2 votes
                                        Sign in
                                        Check!
                                        (thinking…)
                                        Reset
                                        or sign in with
                                        • facebook
                                        • google
                                          Password icon
                                          Signed in as (Sign out)

                                          We’ll send you updates on this idea

                                          0 comments  ·  Microsoft.PowerShell.* Modules  ·  Flag idea as inappropriate…  ·  Admin →
                                        • [Bug]: using module that import a script that import classes have unexpected behavior within a class

                                          ClassA.psm1
                                          ------------------
                                          class ClassA
                                          {
                                          [string]Execute()
                                          {
                                          return "this is from ClassA"
                                          }
                                          }

                                          ClassB.psm1
                                          ------------------
                                          class ClassB
                                          {
                                          [string]Execute()
                                          {
                                          return "this is from ClassB"
                                          }
                                          }

                                          ImportClasses.ps1
                                          -------------------------
                                          using module 'D:\Exemple\Atelier\ClassImportProblem\ClassA.psm1'
                                          using module 'D:\Exemple\Atelier\ClassImportProblem\ClassB.psm1'

                                          process_Classes.ps1
                                          ----------------------------
                                          using module 'D:\Exemple\Atelier\ClassImportProblem\ImportClasses.ps1'

                                          $a = [ClassA]::new()
                                          $b = [ClassB]::new()

                                          class HustonweHaveAProblem
                                          {
                                          [void]HereWeGo(){
                                          $a = [ClassA]::new()
                                          $b = [ClassB]::new()
                                          }
                                          }

                                          Observation:

                                          From that point, instances of ClassA and ClassB are working fine in the process_Classes script. But instances of ClassA and ClassB within the class HustonWeHaveAProblem{} throw errors.

                                          Actual result:

                                          At D:\Exemple\Atelier\ClassImportProblem\process_Classes.ps1:9 char:15
                                          + $a = [ClassA]::new()
                                          + ~~~~~~
                                          Unable to…

                                          1 vote
                                          Sign in
                                          Check!
                                          (thinking…)
                                          Reset
                                          or sign in with
                                          • facebook
                                          • google
                                            Password icon
                                            Signed in as (Sign out)

                                            We’ll send you updates on this idea

                                            0 comments  ·  Microsoft.PowerShell.* Modules  ·  Flag idea as inappropriate…  ·  Admin →
                                          ← Previous 1 3 4 5 74 75
                                          • Don't see your idea?

                                          Feedback and Knowledge Base