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. 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

    19 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 →
  2. New-ScheduledTaskTrigger missing option to NOT 'Synchronize across time zones'

    New-ScheduledTaskTrigger missing option to NOT 'Synchronize across time zones'

    The default is to always set it. This should not be an implied default as it creates problem with Daylight Saving etc.

    To remove must do as follows which should not be needed:

    $str = Get-ScheduledTask -TaskName TESTTASK

    $NewTriggers = @()
    foreach($trigger in $str.Triggers)
    {

    if($trigger.StartBoundary -match '\+01:00$')
    
    {
    $Trigger.StartBoundary = $Trigger.StartBoundary.Substring(0,$Trigger.StartBoundary.Length-6)
    }
    $NewTriggers += $trigger

    }

    $str.Triggers = $NewTriggers
    Set-ScheduledTask -InputObject $str

    Please add switch to disable either through New-ScheduledTaskTrigger or via Set-ScheduledTask

    5 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 →
  3. New-AzAutomationConnection Cmdlet incorrectly states that -ResourceGroupName parameter value exeeds length of 90.

    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.

    13 votes
    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 →
  4. How to modify "Date" column in Windows Explorer

    In Windows Explorer there are two columns available: "Date modified" and "Date". I've tried both setting the .LastWriteTime and .CreationTime for files and it changes the date in the "Date Modified" column, but does not change the "Date" column.

    Is there a way to modify the "Date" column in Windows Explorer using Powershell scripting? I basically want to create a "touch" command that will affect BOTH "Date modified" and "Date" columns in Windows Explorer.

    Thanks!

    5 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 →
  5. ISE updates prematurely

    If you run changes (to see how they work), your changes will be updated if you leave ISE. There should be an 'do you want to update changes?' before quiting

    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  ·  ISE and tooling  ·  Flag idea as inappropriate…  ·  Admin →
  6. 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
    11 votes
    Sign in
    (thinking…)
    Sign in with: Facebook Google
    Signed in as (Sign out)

    We’ll send you updates on this idea

    0 comments  ·  Desired State Configuration (DSC)  ·  Flag idea as inappropriate…  ·  Admin →
  7. DISM creates corrupt archive

    If two (or more) files are present with the exact same content, where file extension is irrelevant also content of file, as long as its the exactly the same; Dism will create a corrupted archive

    e.g.

    a.txt & b.txt

    Content of both files: 0x6c

    Shouldn't this be a case for the dedublication? Both files are separeted inside the wim (Both have only 1 link)

    https://sourceforge.net/p/sevenzip/discussion/45798/thread/db110477b8/

    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 →
  8. "using module" does not provide a way to disable name checking

    The Import-Module cmdlet provides a way to silence the warning about unapproved verbs in function/cmdlet names (-DisableNameChecking). There does not seem to be a way to do this via the "using module" statement, which generates unwanted noise (we have our own internal naming conventions).

    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 →
  9. set-PSrepository doesn't respect verbose parameter

    the "set-PSrepository" cmdlet of the "powershellget" module does not respect the verbose parameter. OS is windows 10.1809.

    steps to reproduce:
    PS C:\Users\Administrator> $PSversiontable

    Name Value


    PSVersion 5.1.17763.1007
    PSEdition Desktop
    PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
    BuildVersion 10.0.17763.1007
    CLRVersion 4.0.30319.42000
    WSManStackVersion 3.0
    PSRemotingProtocolVersion 2.3
    SerializationVersion 1.1.0.1

    PS C:\Users\Administrator> get-command -name 'set-PSrepository'

    CommandType Name Version Source


    Function Set-PSRepository 2.2.2 powershellget

    PS C:\Users\Administrator> powershellget\set-PSrepository -name 'PSgallery' -installationpolicy 'untrusted' -verbose:$false
    VERBOSE: Repository details, Name = 'PSGallery', Location = 'https://www.powershellgallery.com/api/v2'; IsTrusted = 'True'; IsRegistered = 'True'.
    VERBOSE: Repository details, Name = 'PSGallery', Location = 'https://www.powershellgallery.com/api/v2'; IsTrusted = 'True'; IsRegistered = 'True'.
    PS…

    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 →
  10. Bug: ConvertTo-Json produces invalid JSON output for WmiObject

    The following command fails RFC 8259 validation due to escaping problems. This issue can be easily reproduced by pasting the output into a json validator such as jsonlint.com or jsonformatter.curiousconcept.com

    Get-WmiObject -Class Win32_Bios | ConvertTo-Json

    Error: Parse error on line 26:
    ..."Path": { "Path": "\\TST-SRV-01\roo
    ----------------------^
    Expecting 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '[', got 'undefined'

    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  ·  WMI  ·  Flag idea as inappropriate…  ·  Admin →
  11. Problem passing Arguments to Win10 Secondary Tile App

    I am trying to launch the Win10 bluetooth configuration page via PowerShell shortcut.

    In a nutshell:

    start-process -FilePath "shell:appsFolder\windows.immersivecontrolpanel_cw5n1h2txyewy!microsoft.windows.immersivecontrolpanel" -ArgumentList "Page=SettingsPageDevices"

    does open the device settings, but the argument to navigate to the Bluetooth Devices is not taken.

    Background: I exported the tile settings using:
    Export-StartLayout -UseDesktopApplicationID -Path m:\layout.xml
    That gave me:
    <start:SecondaryTile AppUserModelID="windows.immersivecontrolpanelcw5n1h2txyewy!microsoft.windows.immersivecontrolpanel" TileID="SystemSettingsL2_SettingsPageDevices" DisplayName="" Size="2x2" Column="2" Row="0" Arguments="page=SettingsPageDevices" Square71x71LogoUri="ms-appx:///" Square150x150LogoUri="ms-appdata:///local/SettingsTiles/Devices.png" Wide310x150LogoUri="ms-appdata:///local/SettingsTiles/wide.Devices.png" Square310x310LogoUri="ms-appx:///" ShowNameOnSquare150x150Logo="true" ShowNameOnWide310x150Logo="true" BackgroundColor="#00000000" ForegroundText="light" />

    When I call the above to start it in the same way, I am not getting to the arguments being applied. I tried many different notation for the args…

    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  ·  Other PowerShell  ·  Flag idea as inappropriate…  ·  Admin →
  12. How can i write logs to single file using foreach-object parallel?

    Issue
    I am trying to write logs to a single log file using the PSlogging PowerShell module.

    The Script is using the Foreach-object parallel.

    The script works, But sometimes the script gets stuck in between.

    Please help me to resolve it? Is there a better way to achieve this?

    Powershell core 7

    code

    ```
    $sScriptVersion = '1.0'

    $sScriptVersion = '1.0'
    $sLogName = 'custom.log'
    $sLogPath = "C:\Users\Dixon\Desktop\automation\azure\log"
    $sLogFile = Join-Path -Path $sLogPath -ChildPath $sLogName

    Start-Log -LogPath $sLogPath -LogName $sLogName -ScriptVersion $sScriptVersion

    $allServers = $(Get-AzVM -Status)

    try {

    $allServers | ForEach-Object -parallel {
    
    

    $sScriptVersion = &#39;1.0&#39;
    $sLogName = &quot;parallel-&quot; + $_.Name +&quot;.log&quot; …

    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 →
  13. Smartcard support

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

    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  ·  Microsoft.PowerShell.* Modules  ·  Flag idea as inappropriate…  ·  Admin →
  14. Invoke-DscResource always create a CimSession to invoke the DSC resource using WSMan over HTTP

    I am trying to install SQLServer 2019 on Windows Server 2019 using ansible and SqlServerDsc I am getting aN error about missing CimClass MSFT_SqlSetup.

    The error happens when ONLY HTTPS listener is active (The HTTP listener is deleted)

    The investigation from Ansible team shows that the problem comes down to Invoke-DscResource always creating a CimSession to invoke the DSC resource using WSMan over HTTP by the default configured port. The only thing we can control is the port but even then it won't work for the HTTPS listener as the wrong protocol will be used.

    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  ·  Desired State Configuration (DSC)  ·  Flag idea as inappropriate…  ·  Admin →
  15. 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 →
  16. When running exe in scriptblock antimalware executable gets triggered

    I'm attempting to run an executable remotely on a machine that needs updating. Whenever the exe is called, Antimalware Service Executable pops up on the remote machine for a moment, and then nothing else happens.

    Code is attached. Unsure if this is user error/known issue/isolated bug

    2 votes
    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 →
  17. Console applications with a file association start a new cmd window. This is unhelpful.

    I have a simple win32 console application (example.exe) which just printf's all its arguments. In the windows registry I've set up a file association so that the file extension ".myfile" invokes "example.exe %1".

    In a CMD window running .\example.exe file.myfile displays the output in the cmd window. (this is good)
    In a CMD window running .\file.myfile invokes example.exe and displays the output in the cmd window. (this is good)

    In a Powershell window running .\example.exe file.myfile displays the output in the powershell window. (this is good)
    In a powershell window running .\file.myfile opens a new cmd window, in which example.exe…

    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  ·  Other PowerShell  ·  Flag idea as inappropriate…  ·  Admin →
  18. Get-ChildItem -Recurse -Attributes Directory lists $RECYCLE.BIN

    Hello!

    With Powershell 6, my target ist to list all folders.

    I find no way to exclude $RECYCLE.BIN
    :
    Get-ChildItem -LiteralPath 'D:&#39; -Recurse -Attributes !Hidden+!System+!ReadOnly+!Encrypted+!IntegrityStream+Directory `

    -ErrorAction SilentlyContinue
    

    Thank You for advice me

    Erhie

    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 →
  19. Powershell much slower in export to excel

    I am using a script to export a configuration to excel
    running this scipt in powershell 7 (7.0.0) is much slower than in the native powershell for windows 10 (5.1.18362.628).
    This scipt can be found https://github.com/skippernl/Fortigate2Excel
    What could be the cause of this?

    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 →
  20. Test-Path Incorrectly reports false when FileName contains [ ]

    Test-Path incorrectly returns false when FileName contains [ ] brackets

    PS D:&gt; $FN = "D:\DEST2\4213-2(None)(None)[1007959] NULL.pdf";

    PS D:&gt; Test-Path $FN -PathType Any
    False

    PS D:&gt; [System.IO.File]::Exists($FN)
    True

    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  ·  Other PowerShell  ·  Flag idea as inappropriate…  ·  Admin →
← Previous 1 3 4 5 84 85
  • Don't see your idea?

Feedback and Knowledge Base