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. |
-
Fix .NET date formatting bug in .ToString()
PS D:\> gcim win32_operatingsystem | % caption
Microsoft Windows Server 2016 StandardPS D:\> $PSVersionTable.PSVersion
Major Minor Build Revision
----- ----- ----- --------
5 1 14393 1358PS D:\> [DateTime]::Now.ToString('yyyy-MM-dd HH:mm:ss')
2017-07-27 12.29.378 votes -
[Bug] IE automation script will no longer work in PowerShell version 5
To be better notified of incoming tickets in our ticket system I developed a script that opens a hidden IE instance:
$ie = New-Object -ComObject InternetExplorer.Application
(I tried the respective registry entry and "$ie = new-object -Com InternetExplorer.ApplicationMedium", no better.)(This input box is too small.)
After some script statements to log in and navigate to the incoming tickets monitor, I do a
$newcalls = $ie.Document.getElementsByName("callid")
(This input box is too small.)
That's working perfectly fine in PowerShell version 4, but in v5 I get
Exception from HRESULT: 0x800A138A
At <path>.ps1:89
char:5
+ $newcalls = $ie.Document.getElementsByName("callid")
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo…1 vote -
[BUG] Cannot import both PSDesiredStateConfiguration in-box module and PSDscResources (gallery module) in the same configuration
OS: Windows Server 2016 1607 (14393.1593)
PSVersionTable:
Name Value
---- -----
PSVersion 5.1.14393.1532
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.14393.1532
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1PSDscResource module: v2.8.0.0
Take a look at this configuration:
Configuration DependentConfig
{
Import-DscResource -ModuleName PSDscResources -Name RegistryNode MyNode01
{File SetupScript
{
DestinationPath = 'C:\Scripts\hello.txt'
Contents = 'somecommand'
Type = 'File'
Ensure = 'Present'
DependsOn = '[Registry]regCheck'
}
Registry regCheck
{
Key = 'HKEY_LOCAL_MACHINE\SYSTEM\SomeKey'
ValueName = 'SomeValue'
ValueData = 0
ValueType = 'DWord'
Ensure = 'Present'
}
}
}DependentConfig -OutputPath C:\DependentConfig
This requires PSDscResources module version 2.8.0.0 from…
2 votes -
very inconsistent drive letter usage
Hi there
in this case I have to remove and reinstall an OS while booting from usb stick. But this is only one example - it´s not the first time im seeing this behaviour.
if (Test-path c:) {Get-Volume -DriveLetter c | Get-Partition | Remove-PartitionAccessPath -AccessPath c:\}
In this line the term C is used three times
First time as c: (here would be c:\ also possible)
Second time as c (neither c: nor c:\ is working here)
Third time as c:\ (neither c nor c: is working here)I´m working with variables - this means I have to create 3…
1 vote -
[Issue] Get-MessageTrace pipe to Get-MessageTraceDetail
I got some weird data when running below cmdlet
Get-MessageTrace -StartDate "09/11/2017 00:00:00" -EndDate "09/15/2017 00:00:00" -PageSize 10 -Page 1 | Get-MessageTraceDetail | Select-Object Date, MessageTraceID, Event, Data, Detail | Out-GridView
It seems the last event of the first MessageTraceID keeps repating itself and was added next to last event of the next MessageTraceID. And its data keep growing. Please see below image for the clear representation of the issue.
https://1drv.ms/i/s!AtOz2sztWjOapgIwkbjyq-sy4_jmBelow image is the correct MessageDetail of MessageTraceId 2b87f940-0eee-4c39-71a9-08d4f9757430
https://1drv.ms/i/s!AtOz2sztWjOapgPFCL102diF6jRzAnd below image is the correct MessageDetail of MessageTraceId f602c9c7-2a5b-4a5a-1256-08d4f8e9ba58
https://1drv.ms/i/s!AtOz2sztWjOapgSFXfJiKurb23w0Can you please check why it is happening?
…
1 vote -
Powershell does not interpret set variables
Powershell has (optionally) replaced cmd as a standard shell in Windows 10.
However it is a pity that Powershell is not able to interpret commands that rely on usage of variables that are defined in "set"
like %computername%, %windir%, %userprofile%, %appdata% etc
etcPlease respect your own system variables in use for decades Microsoft. Thank you a lot.
There must be way without breaking this.try issuing a simple
cd %appdata%
in powershell (often used in KB articles), good luck and have fun (or not).
Imho while I could understand limitations this is pretty odd.
2 votes -
We need a proper set of built-in, easy-to-use, dedicated registry cmdlets
Managing registry keys and values on local and remote systems with PowerShell is a pain.
Reviewing the articles, forums and blogs on the Internet clearly shows that new PowerShell users struggle to understand how to use registry provider drives and the cmdlets like New-Item, Get-ItemProperty, New-ItemProperty, and so on. This has prompted the creation of a variety of home-brew modules and functions to deal with the problem, like this one, which is extremely useful, but is not built into PowerShell by default of course:
https://gallery.technet.microsoft.com/RegistryLibrarypsm1-b38a81ba
PowerShell needs a proper set of built-in, dedicated registry cmdlets that 1) are easy to…
23 votes -
How do I download modules manually from gallery behind a firewall/proxy?
For companies like banks which are very restrictive regarding internet downloads, I have no internet connectivity directly from powershell, only from my browsers. As such I cannot use install-module from powershell.
Our desktops are only windows 7 but locked down running ps version 2 and powershell console doesn't have proxy access. I cannot run install-module on my servers neither as my servers have no internet connection.
Is there a workaround to download a module manually as a zipped file so that I can I unzip and install them manually in my server?
1 vote -
PS 5 assigning to list value while PS 4 isn´t
Hi!
We recently got WMF 5.1 (KB3191566) that included PS 5.
We then began finding differences in the behavior of PS 5 and PS 4 when running our scripts. The result was different.We didn´t notice this problem since someone wrapped it in a try catch block... So to recreate this issue/bug I made this script and ran it on one host with PS 5 and one VM host on PS 4.
add-type -Language CSharpVersion3 -TypeDefinition @"
public class TestClass
{
public System.Collections.Generic.List<System.Int32> listObject { get; set; }
}
"@[string]$string = "1"
$classWithList = New-Object TestClass
$classWithList.listObject = $string
…
1 vote -
update-help : Failed to update Help for the module(s) 'Provisioning'
I receive the following error when running Update-Help in PowerShell.
PS C:\WINDOWS\System32\WindowsPowerShell\v1.0\Modules\Provisioning> update-help
update-help : Failed to update Help for the module(s) 'Provisioning' with UI culture(s) {en-US} : Unable to retrieve
the HelpInfo XML file for UI culture en-US. Make sure the HelpInfoUri property in the module manifest is valid or
check your network connection and then try the command again.
At line:1 char:1
+ update-help -force
+ ~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (:) [Update-Help], Exception
+ FullyQualifiedErrorId : UnableToRetrieveHelpInfoXml,Microsoft.PowerShell.Commands.UpdateHelpCommandPowerShell info:
PS C:\> $PSVersionTable.PSVersionMajor Minor Build Revision
----- ----- ----- --------
5 1 15063 13826 votespassed this on to the documentation team, thanks.
-
Position of PowerShell window appears behind Windows taskbar when taskbar is at top
Dynamically detecting the taskbar position, and dynamically modifying the starting position of the powershell window when opening powershell might be a good solution. I am on Windows 10 with three monitors. The taskbar is locked, not automatically hidden, taskbar is only shown on main display.
2 votes -
[BUG] Drag and drop to scripts shortcuts split paths containing spaces
Drag and dropping any file to a script shortcut split this path before passing the splitted strings as multiple parameters. Here's my detailed Issue Report :
Steps to reproduce
------------------1 - Get any script, for example :
[samplescript.psd1] :
```
param([string]$path)
Write-Host($path)
pause
```
or a simpler one-line sample: ```Write-Host($args);pause```2 - Create a shortcut that runs the script :
[Shortcut Target ] : ```PowerShell "path\to\our\samplescript.psd1"```3- Drag and drop a file containing spaces in its name to the shortcut
[sample file ] : ```C:\Some file with spaces.txt```Expected behavior
-----------------Drag and dropping the file should pass its…
2 votes -
Invoke-WebRequest and Invoke-RestMethod not working correctly with REST API like cURL
Hi,
Recently I am working on a Telegram Bot creation with power shell, everything working fine except uploading the images via API.If I use cURL, it is working fine using following command, So, technically it should work with native PowerShell commandlet.
curl -s -X POST "https://api.telegram.org/bot11111111:Mykey/sendPhoto?chat_id=-123456789" -F photo="@D:\MyPic.JPG" -F caption="Test"
I have already tried following, but none worked. As per the API Guide (https://core.telegram.org/bots/api), we have to use multipart/form-data for uploading any file, for cURL, without specifying this also works.
Invoke-RestMethod -Uri "https://api.telegram.org/bot$MyBotKey/sendPhoto?chat_id=XXXXXXXXX" -Method Post -InFile "D:\MyPic.JPG" -ContentType "multipart/form-data"
Invoke-WebRequest -Uri "https://api.telegram.org/bot$MyBotKey/sendPhoto?chat_id=-XXXXXXXXX"…1 vote -
Import-Clixml - Serialized XML is nested too deeply.
Import-Clixml 'data.xml'
Import-Clixml : Serialized XML is nested too deeply.
At line:1 char:1
+ Import-Clixml 'data.xml ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Import-Clixml], XmlException
+ FullyQualifiedErrorId : System.Xml.XmlException,Microsoft.PowerShell.Commands.ImportClixmlCommand1 vote -
[Bug] Get-Recipient Filter
when using a variable in -Filter the Filter will not applied.
Get-Recipient -Filter {EmailAddresses -like 'smtp:test@mail.com'}
--> is working$EmailAddress = 'smtp:test@mail.com'
Get-Recipient -Filter {EmailAddresses -like $EmailAddress}
--> is not working$PSVersionTable
Name Value
---- -----
PSVersion 4.0
WSManStackVersion 3.0
SerializationVersion 1.1.0.1
CLRVersion 4.0.30319.36399
BuildVersion 6.3.9600.18773
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0}
PSRemotingProtocolVersion 2.21 vote -
PowerShell Classes should allow properties with get and set
PowerShell classes should more closely mirror the abilities of a C# class imported and allow full differentiation between fields and properties. Properties should allow getter and setter code blocks
3 votes -
Command line parsing bug: spaces and trailing slash
There appears to be a bug parsing arguments to EXEs. If you pass a properly-quoted path that has spaces and a trailing slash, the rest of the command is lumped into the same argument. This also happens if you use a PowerShell variable to hold the path string.
To repro, first, install EchoArgs.exe (if using chocolatey: cinst -y echoargs). It demonstrates what arguments would get passed to any exe.
Then run:
PS> & EchoArgs "C:\spaces and trailing slash\" more args
Echo args shows that it all got lumped into one argument:
Arg 0 is <C:\spaces and trailing slash" more args>
…
6 votes -
Fix get-help for format-volume
under example 2 it says the following
This example performs a full format of the D volume using the FAT32 file system.
with the example code:
PS C:\> Format-Volume -DriveLetter C -FileSystem FAT32 -FullFormat –Force
The example code formats the c drive but the explaination say it will format the d drive could you please make it consistent.1 voteFiled a PR to fix the issue here: https://github.com/MicrosoftDocs/windows-powershell-docs/pull/97
This will fix the issue online; need to figure out how items will get brought back into the console help. -
Get-Credential does not support Smart Card user name hints
If you utilize Smart Cards with certificates that are not directly linked to users (no suitable user DN in Subject and no UPNs in SANs), you are able to link a single certificate to multiple accounts dynamically with the caveat that users need to provide explicit user name hints during logon in order to log on.
User name hints need to be enabled via GPO or registry settings ("X509HintsNeeded"), after which all standard credential dialogs in Windows support them, except PowerShell's Get-Credential. This effectively prevents using PowerShell remoting with such Smart Cards / certificates if different credentials are required.
In…
6 votes -
Stop-Transcript -ErrorAction doesn't work
The ErrorAction parameter on Stop-transcript doesn't work.
for instance with SilenlyContine:
PS G:\> Stop-Transcript -ErrorAction SilentlyContinue
Stop-Transcript : An error occurred stopping transcription: The host is not currently transcribing.
At line:1 char:1
+ Stop-Transcript -ErrorAction SilentlyContinue
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Stop-Transcript], PSInvalidOperationException
+ FullyQualifiedErrorId : InvalidOperation,Microsoft.PowerShell.Commands.StopTranscriptCommandOr with stop:
Script: Stop-Transcript -ErrorAction Stop; write-output "This message sould not be printed"
Result: Stop-Transcript : An error occurred stopping transcription: The host is not currently transcribing.
At home\Untitled4.ps1:1 char:1
+ Stop-Transcript -ErrorAction Stop
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Stop-Transcript], PSInvalidOperationException
+ FullyQualifiedErrorId : InvalidOperation,Microsoft.PowerShell.Commands.StopTranscriptCommandThis message sould…
1 vote
- Don't see your idea?