# 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.
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. ## DHCP Server Class - ASCII data is missing

The output of the Get-DhcpServerv4Class cmdlet give me the information that I need, except for one AsciiData value. I don't know if that is something computed from the corresponding Data value.

PS C:\temp> Get-DhcpServerv4Class -ComputerName $ComputerName -Type "Vendor" | Where-Object {$_.Description -notlike "Microsoft*"}

Name Type Data AsciiData Description
---- ---- ---- --------- -----------
Cisco Aironet 1200 Vendor 0x436973636f2041502063... Cisco AP c1200 Vendor Class Indentifi...
airespace Vendor 0x4169726573706163652e... Airespace.AP1200 1010
Airespace 2700 Vendor 0x436973636f2041502063... Cisco AP c2700 Cisco Aironet 2700 Series
Mitel IP Phone Options Vendor 0x697070686f6e652e6d69... Mitel-specific options...
PXEClient (BIOS) Vendor 0x505845436c69656e743a... PXEClient:Arch:00000 PXEClient (BIOS)
PXEClient (UEFI x64) Vendor 0x505845436c69656e743a...…

1 vote
(thinking…)
Signed in as (Sign out)

We’ll send you updates on this idea

2. ## Start-Job on Windows Server 2016 hangs Powershell

Start-Job seems to sometimes cause the calling thread to hang. If you create a loop in ISE and spin off a bunch of jobs, inevitably it will hang. This has only been tested using a ScriptBlock.

As a workaround, you can use threads to do the heavy lifting and so if they fail to start the job, just recreate the thread.

1 vote
(thinking…)
Signed in as (Sign out)

We’ll send you updates on this idea

3. ## Wrong path delimiters in archive (non-UNC)

The "compress-archive" module stores path delimiters in non UNC format (backslashes instead of slashes) which differs from the builtin zipper in Win10 (Send to Zip-Archive).
This leads to unrecognized files on decompression by i.e. Microsoft Dynamics NAV 2016 (decrompression of an imported zipfile "ControlAddIn.Zip")
If you build the same archive with the Win10-Zipper, the files are recognized correctly.
Used PS-Version : 5.1 build 18362 rev 145
Win10-Pro 64bit version: 10.0.18362.267
Command executed from Visual Studio:
powershell Compress-Archive -Path ".\ControlAddIn\AddIn\*" -CompressionLevel Fastest -DestinationPath "$(SolutionDir)ControlAddIn.zip" I cannot append the two Zip-Archives to let you compare these files by yourself therefore I post… 1 vote Sign in (thinking…) Sign in with: Facebook Google Signed in as (Sign out) We’ll send you updates on this idea 4. ## AzureAD cmdlets vs MSOL cmdlets I am finding that the AzureAD cmdlets do not show me the same list of attributes for a user as the MSOL cmdlets you are deprecating. For example; our sharepoint people need to see the PreferredDataLocation value for content controls, this was available in MSOL and not easily in AzureAD. (I have included 2 user exports to show you what I mean) How do I make the AzureAD cmdlets do what MSOL does? 1 vote Sign in (thinking…) Sign in with: Facebook Google Signed in as (Sign out) We’ll send you updates on this idea 5. ## Scheduledtask commands should support whatif The -ScheduledTask commands that modify state should support the WhatIf parameter. They don't appear to currently as of Server 2016. Specifying -WhatIf to Disable-ScheduledTask says the parameter is unknown. 1 vote Sign in (thinking…) Sign in with: Facebook Google Signed in as (Sign out) We’ll send you updates on this idea 6. ## [BUG] Get-LocalGroupMember and unresolved SID throws error If there is an unresolved SID in a local group the cmdlet Get-LocalGroupMember (and maybe others) throws and error. Module: Microsoft.PowerShell.LocalAccounts Get-LocalGroupMember : Failed to compare two elements in the array. At line:1 char:1 + Get-LocalGroupMember -Group 'RDS Endpoint Servers' + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Get-LocalGroupMember], InvalidOperationException + FullyQualifiedErrorId : An unspecified error occurred.,Microsoft.PowerShell.Commands.GetLocalGroupMemberCommand If the SID is removed, the cmdlet once again works as expected. 3 votes Sign in (thinking…) Sign in with: Facebook Google Signed in as (Sign out) We’ll send you updates on this idea 7. ## How do I create an Azure Automation schedule with PowerShell using the Az Cmdlet New-AzAutomationSchedule? When I attempt to run the Cmdlet below with the following parameters, it fails:$AutomationAccountName = "CZEU1-INF-NP-0faa84be-AAA-01"

$ResourceGroupName = "czeu2-app-np-rgp-01"$vmStartTime = (Get-Date "08:00:00").AddDays(1)

$vmStopTime = (Get-Date "18:00:00")$timeZone = [TimeZoneInfo]::Local.DisplayName

$vmStartupScheduleName = "Startup VMs 08:00 Daily Weekdays:$timeZone"

$vmShutdownScheduleName = "Shutdown VMs 18:00 Daily Weekdays:$timeZone"

[System.DayOfWeek[]]$WeekDays = @([System.DayOfWeek]::Monday..[System.DayOfWeek]::Friday) New-AzAutomationSchedule -AutomationAccountName$AutomationAccountName -Name $vmStartupScheduleName -StartTime$vmStartTime -WeekInterval 1 -DaysOfWeek $WeekDays -ResourceGroupName$ResourceGroupName -Verbose

The error is: New-AzAutomationSchedule : Exception of type 'Microsoft.Azure.Management.Automation.Models.ErrorResponseException' was thrown. At line:1 char:1 + New-AutomationSchedule -AutomationAccountName $AutomationAccountNam... + CategoryInfo : CloseError: (:) [New-AzAutomationSchedule], ErrorResponseException + FullyQualifiedErrorId : Microsoft.Azure.Commands.Automation.Cmdlet.NewAzureAutomationShedule 14 votes Sign in (thinking…) Sign in with: Facebook Google Signed in as (Sign out) We’ll send you updates on this idea 8. ## How to get the future pwd from a profile script? I was pointed to this forum due to https://github.com/PowerShell/PowerShell/issues/10568 I want to start a PS shell from the explorer context menu on different folders. At PS startup a tool should be configured with the actual folder path. I have tried a init / profile script for this purpose, but the pwd of the script is not the folder path: I get C:\WINDOWS\System32. I have also checked variables but non of the available values is set to the (future) folder path. How can I get the folder path in this case? After the shell is started the correct folder path is… 1 vote Sign in (thinking…) Sign in with: Facebook Google Signed in as (Sign out) We’ll send you updates on this idea 9. ## Powershell Pipe is not respecting the AllParameterSets value . Repro: using the following script: function Test { [CmdletBinding()] Param( [string]$name,

[Parameter(Mandatory = $True, ParameterSetName = "Set1")] [Parameter(Mandatory =$True, ParameterSetName = "Set2")]
[string] $P1, [Parameter(Mandatory =$True, ParameterSetName = "Set2")]
[string] $P2 ) Write-Output ($name + " - " + $PsCmdlet.ParameterSetName) } #The following Fails! e.g. Powershell doesn't resolve to ParameterSet "Set1" 'aaa' | Test -P1 x 1 vote Sign in (thinking…) Sign in with: Facebook Google Signed in as (Sign out) We’ll send you updates on this idea 10. ## profile.ps1 doesnt load when Windows Powershell 2.0 engine was disabled. We have been using automation script for our deployment. We are using the latest version of System.Management.Automation. System.Management.Automation, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 We have few modules referred in profile.ps1 which automatically loads when we execute the ps1 files. This works fine if we have enabled Windows Powershell 2.0 engine. If we disable Windows Powershell 2.0 Engine this doesnt load the profile.ps1 in$pshome and scripts throws functions not found error.

This seems to be weird behavior as all our scripts still works with Powershell 5.1

Would need your attention to help fixing this or provide a solution to fix this.

1 vote
(thinking…)
Signed in as (Sign out)

We’ll send you updates on this idea

There appears to be a bug when using this Cmdlet, where the -ResourceGroupName parameter incorrectly states that the parameter value for the resource group exceeds a length of 90 when a variable is used, i.e. $rgName (string length is actually 19 <CZEU2-APP-NP-RGP-01>. When the hard coded value of: "CZEU2-APP-NP-RGP-01" is used however, the Cmdlet works as designed. 10 votes Sign in (thinking…) Sign in with: Facebook Google Signed in as (Sign out) We’ll send you updates on this idea 12. ## ActiveDirectory PowerShell module isn't thread-safe Accessing Active Directory Web Services (ADWS) by launching and running a number of PowerShell Runspaces in parallel from within the same process makes ADWS fail with error message "invalid enumeration context". Apparently, the ActiveDirectory PowerShell module is not thread-safe. Please fix soon. There is no workaround for this issue. See this repository for steps to reproduce: https://github.com/SetTrend/powershell-test 2 votes Sign in (thinking…) Sign in with: Facebook Google Signed in as (Sign out) We’ll send you updates on this idea 13. ## Filesystem PSProvider Doesn't Handle Folder with Trailing Space *-Item -Path "$home\try \it.txt" fails, even if "$home\try " exists. Note trailing space character after folder name. This has been observed for New-Item (using -Force), Get-Item, Get-ChildItem. This is on Windows 10 Enterprise versions PSH: 5.1.17763.592 + Winver: 1809 build 17763.678 PSH: 5.1.18362.145 + Winver: 1903 build 18362.295 2 votes Sign in (thinking…) Sign in with: Facebook Google Signed in as (Sign out) We’ll send you updates on this idea 14. ## MinimumCompatibleVersion still causes "Cannot find module PSDesiredStateConfiguration_1.0 from the server" Although a very similar issue has been resolved in WMF5.1 we are encountering an issue when working with partial configurations. It seems that the MinimumCompatibleVersion for the complete configurations is taken from the "first" (alphabetical order) partial configuration. If this happens to be a 2.0.0 configuration then other partials which were 1.0.0 cannot load the PSDesiredStateConfiguration module. Please take a look at the reproduction in the attachment. We reproduced this on windows server 2012r2, 2016 and 2019 and it is causing a very blocking issue for us. Edit; since the attachments dont seem to work: if (-not$inputCredential)
{
\$inputCredential…

(thinking…)
Signed in as (Sign out)

We’ll send you updates on this idea

15. ## How do you upgrade powershell 5.0 to 5.1 on Windows 10 LTSB 10240. I cannot see how to do this?

How do you upgrade powershell 5.0 to 5.1 on Windows 10 LTSB 10240. I cannot see a 5.1 version because all the articles say that Windows 10 already comes with 5.1 but not in LTSB version 10240?
Thank you

1 vote
(thinking…)
Signed in as (Sign out)

We’ll send you updates on this idea

16. ## BUG: Dsc Engine Merge configuration doesn't compare Table String type as expected

When you run Start-DscConfiguration to apply a new configuration, LCM merge all the configuration settings who belong to the same node name. Like the file below. When sacfg (alias) run, then the ValueData of the two resource are compared by the merge processus. Then the merge fail because ValueData is declared as String[] (table) type into the RegistryResource .mof file.
Below you can find the configuration file to create the issue.
Another behavior:
If you specify a string array with several value then PowerShell "PSDesiredStateConfiguration.psm1" throw an error at the execution instead of the LCM. The compared values are always…

1 vote
(thinking…)
Signed in as (Sign out)

We’ll send you updates on this idea

17. ## Smartcard support

Add Smartcard support to Get-Credential in Powershell 7. Add a cmdlet for enumerating certificates on a smartcard

(thinking…)
Signed in as (Sign out)

We’ll send you updates on this idea

calendar = ns.GetDefaultFolder(Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderCalendar);

appointments = calendar.Items;

I can use the C# source code to add ItemAdd event, how to do the same thing in powershell?

1 vote
(thinking…)
Signed in as (Sign out)

We’ll send you updates on this idea

19. ## Start-Transcript causes skipped records when passing SqlDataReader object to another function

Encountering an issue with Start-Transcript, SQLDataReader and Passing it to a function for processing. This occurs in Powershell 6, started in 5.1, was not present in Windows Powershell 3 (Windows Powershell 4 has issues passing the SqlDataReader object to a function anyway).

When you call a function within a Start-Transcript block, and that function then fills a SqlDataReader object, and then passes it onto another function, it increments the record a number of times, as if calling the read() method 7 or 8 times. This causes a number of issues, firstly, a lot of data is skipped for processing, secondly,…

1 vote
(thinking…)
Signed in as (Sign out)

We’ll send you updates on this idea

20. ## New request -- get-winevent :get all log generated by a specific user

If I try to find when the user abc.cd logon to my computer.
I will do a log query as follow.
Get-WinEvent -FilterHashtable @{logname='security';data='abc.cd';id=4624}

If I want to know when a software was install on computer.
I will do a log query as follow.
Get-WinEvent -FilterHashtable @{logname='application';id=11707}

but It does not work with a user ID as follow.
Get-WinEvent -FilterHashtable @{logname='application';id=11707;data='abc.cd'}

What I do I want is collectting all logs that caused by the user abc.cd by using get-winevent , like he installs a new software , he starts a service ,he starts a scheduled task ..

expected cmdlet:
Get-WinEvent…

1 vote