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.
  • Hot ideas
  • Top ideas
  • New ideas
  • My feedback
  1. Update-module needs flag to remove previous versions

    When you run the Update-Module cmdlet there should be a flag to say update the module to the newest version and remove all previous versions. I understand the default being to leave existing versions, but if you DO really want to remove the older versions it becomes pretty painful when you start dealing with a suite of modules like AzureRM. Since each of the underlying modules are different versions it's not like you can easily just do a uninstall-module with a version restriction on all at the same time.

    9 votes
    Sign in
    (thinking…)
    Sign in with: Facebook Google
    Signed in as (Sign out)

    We’ll send you updates on this idea

    6 comments  ·  PowerShell Gallery  ·  Flag idea as inappropriate…  ·  Admin →

    Wanted to update this thread with the current status and an approach that will allow uninstalling easily.

    At this time we are not planning on implementing this feature. There are a large number of error conditions that can arise during an installation, and the general PS approach is not to add large numbers of parameters to support what are actually separate actions. In this case, the install and uninstall are separate.

    The following command can be used (without the ending -Whatif) to clean up older versions of installed modules:
    $Latest = Get-InstalledModule (modulename); Get-InstalledModule (modulename) -AllVersions | ? {$_.Version -ne $Latest.Version} | Uninstall-Module -WhatIf

  2. ISE syntax highlighting/intellisense bug

    When calling a .NET static method/property as an argument to a powershell function, intellisence/syntax highlighting breaks. For example, as copied from ISE:

    New-ItemProperty -Path $Path -Name $Key -Value $Value -PropertyType ([Microsoft.Win32.RegistryValueKind]::DWord) # ISE correctly parses

    New-ItemProperty -Path $Path -Name $Key -Value $Value -PropertyType [Microsoft.Win32.RegistryValueKind]::DWord # ISE incorrectly parses

    0 votes
    Sign in
    (thinking…)
    Sign in with: Facebook Google
    Signed in as (Sign out)

    We’ll send you updates on this idea

    1 comment  ·  ISE and tooling  ·  Flag idea as inappropriate…  ·  Admin →

    Per the discussion, this seems to be operating properly. If we missed something, please add additional information to the item so we can understand it better.

  3. Provide docs / Docker image for hosting custom PowerShellGallery

    It would be nice to understand options on hosting custom, private PowerShellGallery with modules intended to be private.

    There might be a guide on setting up a custom NuGet gallery or a Docker image so that we would be able to spin up a new one really fast.

    A Docker image is a preferable one.

    8 votes
    Sign in
    (thinking…)
    Sign in with: Facebook Google
    Signed in as (Sign out)

    We’ll send you updates on this idea

    0 comments  ·  PowerShell Gallery  ·  Flag idea as inappropriate…  ·  Admin →

    After trying to make this work for some time, we have decided that we really can’t support this in an ongoing basis.

    There was a DSC configuration created that set up a copy of the (then) current PS Gallery. The problem we encountered with it is the ongoing maintenance cost of keeping the published version in synch with our changes, particularly when you realize that the Gallery is a multi-tier app.

    As a result, we have to decline this request, and instead ask users to leverage a NuGet-based repo if they want one.

  4. array bug

    I was playing around with copy-property, and made a list-property to show properties/noteproperties, etc. of objects/arrays. Anyways, I ran this command:
    $b = get-wmiobject win32physicalmemory | select pscomputername,banklabel,@{Name="Capacity"; Expression={"$($.capacity/1GB) GB"}},partnumber,serialnumber,speed | ft

    and received a system.array object...however, when I display that object:
    $b | ft
    it shows four elements
    when I use get-member it freaks out.
    when I use $b.count, it gives 8 as the answer.
    I have four slots of RAM, and it displays the correct info for all four.
    Is this a bug, or something that I am just being a "seriously flawed human" about. To…

    1 vote
    Sign in
    (thinking…)
    Sign in with: Facebook Google
    Signed in as (Sign out)

    We’ll send you updates on this idea

    1 comment  ·  WMI  ·  Flag idea as inappropriate…  ·  Admin →
  5. Enable hosting private modules on PowerShell Gallery

    There is no clear documentation directly on how to host an internal PowerShell Gallery to the pedigree of powershellgallery.org. Rather than support this scenario, it would be great if we could publish private PowerShell Gallery modules to powershellgallery.org. We can already log into powershellgallery.org with Work accounts, so I presume the bulk of the work has been completed--you would just need to require credentials for private modules and validate that the user's AAD tenant is the same as the publisher's AAD tenent.

    2 votes
    Sign in
    (thinking…)
    Sign in with: Facebook Google
    Signed in as (Sign out)

    We’ll send you updates on this idea

    0 comments  ·  PowerShell Gallery  ·  Flag idea as inappropriate…  ·  Admin →

    This has been suggested previously, and unfortunately, is not easy as implied by this suggestion.

    Managing group membership and associating that with individual items requires a great deal of plumbing. In addition, the PowerShell Gallery browse and acquisition (install, save, update cmdlets) operate anonymously.

    While these things could be done, they are not part of the strategic direction for the PowerShell Gallery at this time.

  6. Top-level error handling in psm1 module

    I have some functions defined in a .psm1 file. I added a trap block at the top level, but it only gets hit if there are errors during import. I expect this trap to be triggered if any of my functions throws an error. Adding a trap to every single function is not feasible.

    Repro:

    1) Create Test.psm1 with these contents:

    $ErrorActionPreference = 'Stop'
    trap { Write-Host "Eep"; throw $_ }

    function Throw-Foo()
    {
    throw "Foo"

    }

    2) Import-Module .\Test.psm1
    3) Throw-Foo

    Expected result:
    Eep
    Foo
    At ...

    Actual result:
    Foo
    At ...

    1 vote
    Sign in
    (thinking…)
    Sign in with: Facebook Google
    Signed in as (Sign out)

    We’ll send you updates on this idea

    2 comments  ·  PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →

    Given what I know about the scoping of trap statements, this looks like “by design” behavior to me. More on that:

    about_Trap: https://msdn.microsoft.com/en-us/powershell/reference/5.0/microsoft.powershell.core/about/about_trap#trapping-errors-and-scope
    Great discussion on Trap vs. Try/Catch: https://powershell.org/2013/06/11/powershell-great-debate-error-trapping/

    For your immediate problem, I think you could just make a “ProxyThrow” function that defines it’s own scoped Trap and Throws.

  7. PowershellGallery - Preview module cmdlet examples

    Hello,

    Many PowershellGallery modules's description is just one line that make us difficult to chose among the similar modules.

    For example, I searched the keyword log, and I got many write-log modules.

    I need to download each one of them to test the differences.

    It would be better to preview the cmdlets' examples directly on the web site or provided by find-module.

    And if possible, it would be even better to be able to upload some GIF photos to the web site to show the cmdlets' power dynamically just like vscode extensions.

    Thx.

    1 vote
    Sign in
    (thinking…)
    Sign in with: Facebook Google
    Signed in as (Sign out)

    We’ll send you updates on this idea

    1 comment  ·  PowerShell Gallery  ·  Flag idea as inappropriate…  ·  Admin →

    First, thanks for asking, we really do appreciate the feedback.
    We have investigated doing this before, and it turns out to be complex.

    While it’s been done, it’s not common for a reason. Some of the issues involve creating a service that is effectively a sandbox designed to run a huge variety of cmdlets, while ensuring that it cannot become a DOS attack vector for the service as a whole.

    Rather than leave the request open, we are marking it as “declined” for now.

  8. Management tools powershell modules in PS Gallery

    Publish all In-Box PowerShell modules to the gallery so scripted functions that do not actually required the full features can be used. Such as Invoke-GpUpdate.

    2 votes
    Sign in
    (thinking…)
    Sign in with: Facebook Google
    Signed in as (Sign out)

    We’ll send you updates on this idea

    0 comments  ·  Microsoft.PowerShell.* Modules  ·  Flag idea as inappropriate…  ·  Admin →

    As it turns out, this is really difficult and the likelihood of delivering something that would work is not high.

    The biggest issue with providing the in-box modules via the Gallery is that the PowerShell modules you are interested in require other code elements that ship as part of the Windows versions the PowerShell code ships in. If you don’t have a matching set, the PowerShell cmdlets can’t work.

    Moving forward, many teams are considering using the PowerShell Gallery as their primary path to providing PowerShell modules. That will require changes to how they develop the PS code, and make this easier.

    However, repackaging existing in-box modules & delivering them via the PS Gallery will not be successful.

  9. $ERRORLEVEL Or Fix $LastExitCode

    Hello,

    I don't know if you look at forum on the internet about error management on powershell but no one have a simply and correct code to have this information

    $Lastexitcode : never work
    $? : works strangely
    Try/Catch : Not good enough

    Why to not just use $Errorlevel as on cmd ?

    If ($Errorlevel -eq 0 ) { Do something } else { Do other thing }

    Or fix $LastExitCode

    Best Regards

    1 vote
    Sign in
    (thinking…)
    Sign in with: Facebook Google
    Signed in as (Sign out)

    We’ll send you updates on this idea

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

    Check out this documentation on Automatic Variables: https://msdn.microsoft.com/en-us/powershell/reference/5.1/microsoft.powershell.core/about/about_automatic_variables

    $? is designed to output whether the last operation was successful or not ($true/$false):
    “Contains the execution status of the last operation. It contains TRUE if the last operation succeeded and FALSE if it failed.”

    $LASTEXITCODE “Contains the exit code of the last Windows-based program that was run.” This only applies to native binaries. Try this:

    PS C:\Users\jaiello> clip

    INFO: Type “CLIP /?” for usage.
    PS C:\Users\jaiello> $LASTEXITCODE
    0
    PS C:\Users\jaiello> clip foo
    ERROR: Invalid argument/option – ‘foo’.
    Type “CLIP /?” for usage.
    PS C:\Users\jaiello> $LASTEXITCODE
    1

    If you still feel like these don’t meet your needs, please file an issue at https://github.com/powershell/powershell/issues

  10. 1 vote
    Sign in
    (thinking…)
    Sign in with: Facebook Google
    Signed in as (Sign out)

    We’ll send you updates on this idea

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

    I can’t repro this on my personal machine (even with the Taskbar moved to the top). Every entrypoint/shortcut for PowerShell (or cmd.exe for that matter) have their own window/console properties that get saved for that entrypoint/shortcut. I recommend that you right-click the PowerShell icon in the console title bar, select Properties, Layout, and fiddle with the Window Position (you probably want to uncheck “Let System Position Window”.

    Thanks,
    Joey

  11. -certificate parameter needed on the Install-Module cmdlet

    I have built an internal Powershell Gallery where all uploaded (Powershell related) items are signed but I am in an 'Allsigned' environment mandated from 'on high' that cannot be changed which means that every time someone uses the 'Install-Module' cmdlet at the moment, unless they're installing something directly from my, self-managed, internal Gallery, whatever they've decided to install and download can't work unless they go find it and sign it as a seperate step. It would present less of a barrier to adoption to people if the downloading of a module from a repository allowed them to run the downloaded…

    1 vote
    Sign in
    (thinking…)
    Sign in with: Facebook Google
    Signed in as (Sign out)

    We’ll send you updates on this idea

    0 comments  ·  Package Management  ·  Flag idea as inappropriate…  ·  Admin →
  12. 2 votes
    Sign in
    (thinking…)
    Sign in with: Facebook Google
    Signed in as (Sign out)

    We’ll send you updates on this idea

    0 comments  ·  PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →
  13. Single line comments broken in Windows 10 "fast ring" 15031.rs2_release.170204-1546

    Anyone else on the fast ring having the same problem?

    PS C:\Users\marco> "a";# foo;"b"

    a

    PS C:\Users\marco> $psversiontable

    Name Value


    PSVersion 5.1.15031.0

    PSEdition Desktop

    PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}

    BuildVersion 10.0.15031.0

    CLRVersion 4.0.30319.42000

    WSManStackVersion 3.0

    PSRemotingProtocolVersion 2.3

    SerializationVersion 1.1.0.1

    PS C:\Users\marco> "a";<# foo#>;"b"

    a

    b

    PS C:\Users\marco>

    1 vote
    Sign in
    (thinking…)
    Sign in with: Facebook Google
    Signed in as (Sign out)

    We’ll send you updates on this idea

    1 comment  ·  Other PowerShell  ·  Flag idea as inappropriate…  ·  Admin →

    That behavior appears to “by design” to me. As far as the parser can tell, your `;` is part of the comment you started with `#`. In addition to the workaround you posted yourself, you could do a after (or before) the `;`, and the parser would terminate the comment via a newline.

    Was this behavior different before the build you referenced in your title?

  14. Alias "clip" to Set-Clipboard by default.

    Set-Clipboard can do anything Powershell-wise that clip.exe was able to do, and more - scb works well with Unicode text, whereas clip.exe can falter.

    Example case: Try running irm shrug.io | clip and pasting somewhere, followed by irm shrug.io | scb and pasting again. One will notice that using scb preserves all of the shruggie in its lackadaisical glory (¯_(ツ)_/¯), whereas clip.exe has issues.

    At this point, I think that clip.exe can be safely relegated to being an artifact of a bygone era and that set-clipboard can be used to take its place.

    3 votes
    Sign in
    (thinking…)
    Sign in with: Facebook Google
    Signed in as (Sign out)

    We’ll send you updates on this idea

    0 comments  ·  Other PowerShell  ·  Flag idea as inappropriate…  ·  Admin →

    I’d love to, but given that we’ve already been burned by this whole “aliases masking whether you’re using the native executable or the PowerShell cmdlet” business (context here: https://github.com/PowerShell/PowerShell/pull/1901), and given that there are slight behavioral differences between the two, I’m going to have to recommend that you just put it in your profile.

    To give a brief example: say we add this default alias. “… | clip” starts getting used in scripts (this is why you don’t use aliases in your scripts!), and all of the sudden there’s a bunch of scripts out in the wild with different behavior, and no clear reason why unless you’re familiar with the aliases we added, and in which version.

    If you feel strongly that I’m wrong, feel free to file an issue on GitHub to affect PowerShell Core 6.0: https://github.com/powershell/powershell/issues

    Thanks,
    Joey

  15. Support proxy of PowerShell Gallery

    Proxy is NOT supported in PowerShell Gallery now.
    Although the "-Proxy" option exists, it seems that it does not work effectively.
    Please supported proxy.

    1 vote
    Sign in
    (thinking…)
    Sign in with: Facebook Google
    Signed in as (Sign out)

    We’ll send you updates on this idea

    0 comments  ·  PowerShell Gallery  ·  Flag idea as inappropriate…  ·  Admin →
  16. Updating SharePoint Managed Metadata fields using values from CSV file

    Dear all,

    I have been tasked to update metadata fields in a document library by reading inputs from a CSV file. Based on my little understanding of powershell, I have written the code below but it doesn't work. I hope someone can help me. Sorry if this is not an appropriate forum for this.

    Add-PSSnapin Microsoft.SharePoint.PowerShell

    $web=get-SPWeb "http://myServer:9600/sites/custdocstore1&quot;
    $web.title
    $list.title

    $CRMCols = Import-Csv "G:\Backup files\MetadataUpdateFromCRMToSharePointFew.csv"

    Getting the term (new value) to which we want to update the column

    $termstore = $session.TermStores["Managed Metadata Service"] #["termstore name"]
    $group = $termstore.Groups["MyCompany Customer Document Management"]
    $termset = $group.TermSets["Document Category"]

    List/Library we want

    1 vote
    Sign in
    (thinking…)
    Sign in with: Facebook Google
    Signed in as (Sign out)

    We’ll send you updates on this idea

    0 comments  ·  Microsoft.PowerShell.* Modules  ·  Flag idea as inappropriate…  ·  Admin →
  17. Powershell Support all DOS Commands

    Merge all DOS Commands into PowerShell. Instead of switching between DOS and PowerShell command prompt, do everything from PowerShell. Then you could associate CMD to PowerShell. The PowerShell Commands would have the same switches as the DOS commands.

    1 vote
    Sign in
    (thinking…)
    Sign in with: Facebook Google
    Signed in as (Sign out)

    We’ll send you updates on this idea

    3 comments  ·  Other PowerShell  ·  Flag idea as inappropriate…  ·  Admin →

    Hi there,

    I know it’s annoying to switch back and forth between cmd and PowerShell, but there’s some complexity there that’s hard to overcome without breaking the language. For instance, we could make a function that “aliases” (I put this in quotes because it’s technically not a PowerShell alias, but would be loosely functioning as one) mklnk to `New-Item -Type [SymbolicLink | Junction | HardLink`, but it would require some very custom logic that changes the /-based parameters to —based parameters. (And this comes at a time when we’re trying to move away from legacy aliases in order to support before cross-platform abstraction: https://github.com/PowerShell/PowerShell/issues/929)

    That being said, native binaries (e.g. net.exe) work perfectly fine in PowerShell provided you use the —% switch to fall back into basic parsing before you specify any / parameters (run `Get-Help about_parsing` for more infomation). Though unfortunately, this doesn’t support cmd built-ins.

    If you…

  18. PowerShell ISE - TFS Integration

    Is it too much to ask to get a simple a add-on to be able to Check-Out and Check-In your code from ISE back to TFS, similar to this: https://psisetfsaddon.codeplex.com/ ?

    I've found that in my current role, a lot of people are hesitant to use TFS for their code since they don't have an easy way to check their code unless they install Visual Studio.

    They're currently using PowerGUI to do this but even this work-around is not the best.

    I use Visual Studio, but I'm a full time dev, most people are only editing 1 or 2 scripts…

    1 vote
    Sign in
    (thinking…)
    Sign in with: Facebook Google
    Signed in as (Sign out)

    We’ll send you updates on this idea

    0 comments  ·  ISE and tooling  ·  Flag idea as inappropriate…  ·  Admin →
  19. Find all modules that depend on a certain module

    I'd like Find-Module to support discovery of modules that depend on other modules.

    e.g.
    Find-Module -DependsOn Pester -Recurse

    For module authors: this allows you to discover other modules that build on what you do, which can be helpful as you add new features/value over time.

    For module users: this allows you to search for modules that build on other modules you use, so when you are looking for features/functionality that aren't already there, you may be able to discover other modules that provide them this way.

    2 votes
    Sign in
    (thinking…)
    Sign in with: Facebook Google
    Signed in as (Sign out)

    We’ll send you updates on this idea

    2 comments  ·  Package Management  ·  Flag idea as inappropriate…  ·  Admin →

    Thanks for asking about this, we do need to provide the information as it’s important for publishers.

    Turns out that this is something you can currently do, using this script:
    Find-Module | Where-Object { $.Dependencies | Where-Object { $.Name -eq ’Pester’} }

    We are updating the FAQ documentation to include this info.
    If we get a lot of people requesting this to be built-in for find-X, we’ll review this again.

  20. Get-Date -Format mm/dd/yyyy outputs as Get-Date -Format dd/mm/yyyy

    Here is the output of the two commnads in the subject:

    PS C:\Scripts> Get-Date -Format mm/dd/yyyy
    25/05/2016

    PS C:\Scripts> Get-Date -Format dd/mm/yyyy
    05/26/2016

    1 vote
    Sign in
    (thinking…)
    Sign in with: Facebook Google
    Signed in as (Sign out)

    We’ll send you updates on this idea

    1 comment  ·  Microsoft.PowerShell.* Modules  ·  Flag idea as inappropriate…  ·  Admin →
← Previous 1 3
  • Don't see your idea?

Feedback and Knowledge Base