PowerShell
Repos
102

PowerShell for every system!

37672
5981

RFC (Request for Comments) documents for community feedback on design changes and improvements to PowerShell ecosystem

387
110

Win32 port of OpenSSH

6528
671

Provides PowerShell language and debugging support for Visual Studio Code

1526
433

Download ScriptAnalyzer from PowerShellGallery

1597
315

Central repository for PowerShell Desired State Configuration (DSC) resources.

766
203

Events

issue comment
Corrupted terminal output after window resized

This is a known issue, its tricky because PSReadLine does not get constant updates on Window Change events in a cross platform way. Marking as bug and will explore possible solutions

Created at 2 hours ago
Created at 2 hours ago
Created at 2 hours ago
System.NullReferenceException: Object reference not set to an instance of an object

Hi, my name is klawrawkz. I am fine, how are you?

I get a similar error. I have not been able to track down a theoretical cause yet. The exception comes and goes like Michelangelo; today it has come, has not gone, continues to blow up, and is a real hassle because VSCode | POSH "intellisense" gets hosed and the only solution is to do a "F1 | > Developer: Reload Window" to get it working again.

Here is the output from PowerShell Editor Services:

[Warn - 4:21:40 PM] OmniSharp.Extensions.LanguageServer.Server.Configuration.DidChangeConfigurationProvider: No ConfigurationItems have been defined, configuration won't surface any configuration from the client! | [Warn - 4:27:02 PM] Microsoft.PowerShell.EditorServices.Handlers.PsesCompletionHandler: Exception occurred while running handling completion request - System.NullReferenceException: Object reference not set to an instance of an object. at Microsoft.PowerShell.EditorServices.Services.Symbols.AstOperations.GetCompletionsAsync(Ast scriptAst, Token[] currentTokens, Int32 fileOffset, IInternalPowerShellExecutionService executionService, ILogger logger, CancellationToken cancellationToken) in D:\a\_work\1\s\src\PowerShellEditorServices\Services\Symbols\Visitors\AstOperations.cs:line 130 at Microsoft.PowerShell.EditorServices.Handlers.PsesCompletionHandler.GetCompletionsInFileAsync(ScriptFile scriptFile, Int32 lineNumber, Int32 columnNumber, CancellationToken cancellationToken) in D:\a\_work\1\s\src\PowerShellEditorServices\Services\TextDocument\Handlers\CompletionHandler.cs:line 205 at Microsoft.PowerShell.EditorServices.Handlers.PsesCompletionHandler.Handle(CompletionParams request, CancellationToken cancellationToken) in D:\a\_work\1\s\src\PowerShellEditorServices\Services\TextDocument\Handlers\CompletionHandler.cs:line 74 | [Warn - 4:27:12 PM] Microsoft.PowerShell.EditorServices.Handlers.PsesCompletionHandler: Exception occurred while running handling completion request - System.NullReferenceException: Object reference not set to an instance of an object. at Microsoft.PowerShell.EditorServices.Services.Symbols.AstOperations.GetCompletionsAsync(Ast scriptAst, Token[] currentTokens, Int32 fileOffset, IInternalPowerShellExecutionService executionService, ILogger logger, CancellationToken cancellationToken) in D:\a\_work\1\s\src\PowerShellEditorServices\Services\Symbols\Visitors\AstOperations.cs:line 130 at Microsoft.PowerShell.EditorServices.Handlers.PsesCompletionHandler.GetCompletionsInFileAsync(ScriptFile scriptFile, Int32 lineNumber, Int32 columnNumber, CancellationToken cancellationToken) in D:\a\_work\1\s\src\PowerShellEditorServices\Services\TextDocument\Handlers\CompletionHandler.cs:line 205 at Microsoft.PowerShell.EditorServices.Handlers.PsesCompletionHandler.Handle(CompletionParams request, CancellationToken cancellationToken) in D:\a\_work\1\s\src\PowerShellEditorServices\Services\TextDocument\Handlers\CompletionHandler.cs:line 74 | [Warn - 4:31:51 PM] Microsoft.PowerShell.EditorServices.Handlers.PsesCompletionHandler: Exception occurred while running handling completion request - System.Threading.Tasks.TaskCanceledException: A task was canceled. at Microsoft.PowerShell.EditorServices.Services.Symbols.AstOperations.GetCompletionsAsync(Ast scriptAst, Token[] currentTokens, Int32 fileOffset, IInternalPowerShellExecutionService executionService, ILogger logger, CancellationToken cancellationToken) in D:\a\_work\1\s\src\PowerShellEditorServices\Services\Symbols\Visitors\AstOperations.cs:line 85 at Microsoft.PowerShell.EditorServices.Handlers.PsesCompletionHandler.GetCompletionsInFileAsync(ScriptFile scriptFile, Int32 lineNumber, Int32 columnNumber, CancellationToken cancellationToken) in D:\a\_work\1\s\src\PowerShellEditorServices\Services\TextDocument\Handlers\CompletionHandler.cs:line 205 at Microsoft.PowerShell.EditorServices.Handlers.PsesCompletionHandler.Handle(CompletionParams request, CancellationToken cancellationToken) in D:\a\_work\1\s\src\PowerShellEditorServices\Services\TextDocument\Handlers\CompletionHandler.cs:line 74 | [Warn - 4:45:10 PM] Microsoft.PowerShell.EditorServices.Handlers.PsesCompletionHandler: Exception occurred while running handling completion request - System.Threading.Tasks.TaskCanceledException: A task was canceled. at Microsoft.PowerShell.EditorServices.Services.Symbols.AstOperations.GetCompletionsAsync(Ast scriptAst, Token[] currentTokens, Int32 fileOffset, IInternalPowerShellExecutionService executionService, ILogger logger, CancellationToken cancellationToken) in D:\a\_work\1\s\src\PowerShellEditorServices\Services\Symbols\Visitors\AstOperations.cs:line 141 at Microsoft.PowerShell.EditorServices.Handlers.PsesCompletionHandler.GetCompletionsInFileAsync(ScriptFile scriptFile, Int32 lineNumber, Int32 columnNumber, CancellationToken cancellationToken) in D:\a\_work\1\s\src\PowerShellEditorServices\Services\TextDocument\Handlers\CompletionHandler.cs:line 257 at Microsoft.PowerShell.EditorServices.Handlers.PsesCompletionHandler.Handle(CompletionParams request, CancellationToken cancellationToken) in D:\a\_work\1\s\src\PowerShellEditorServices\Services\TextDocument\Handlers\CompletionHandler.cs:line 91 | [Warn - 4:45:22 PM] Microsoft.PowerShell.EditorServices.Handlers.PsesCompletionHandler: Exception occurred while running handling completion request - System.Threading.Tasks.TaskCanceledException: A task was canceled. at Microsoft.PowerShell.EditorServices.Services.Symbols.AstOperations.GetCompletionsAsync(Ast scriptAst, Token[] currentTokens, Int32 fileOffset, IInternalPowerShellExecutionService executionService, ILogger logger, CancellationToken cancellationToken) in D:\a\_work\1\s\src\PowerShellEditorServices\Services\Symbols\Visitors\AstOperations.cs:line 141 at Microsoft.PowerShell.EditorServices.Handlers.PsesCompletionHandler.GetCompletionsInFileAsync(ScriptFile scriptFile, Int32 lineNumber, Int32 columnNumber, CancellationToken cancellationToken) in D:\a\_work\1\s\src\PowerShellEditorServices\Services\TextDocument\Handlers\CompletionHandler.cs:line 257 at Microsoft.PowerShell.EditorServices.Handlers.PsesCompletionHandler.Handle(CompletionParams request, CancellationToken cancellationToken) in D:\a\_work\1\s\src\PowerShellEditorServices\Services\TextDocument\Handlers\CompletionHandler.cs:line 91 | [Warn - 4:45:27 PM] Microsoft.PowerShell.EditorServices.Handlers.PsesCompletionHandler: Exception occurred while running handling completion request - System.Threading.Tasks.TaskCanceledException: A task was canceled. at Microsoft.PowerShell.EditorServices.Services.Symbols.AstOperations.GetCompletionsAsync(Ast scriptAst, Token[] currentTokens, Int32 fileOffset, IInternalPowerShellExecutionService executionService, ILogger logger, CancellationToken cancellationToken) in D:\a\_work\1\s\src\PowerShellEditorServices\Services\Symbols\Visitors\AstOperations.cs:line 141 at Microsoft.PowerShell.EditorServices.Handlers.PsesCompletionHandler.GetCompletionsInFileAsync(ScriptFile scriptFile, Int32 lineNumber, Int32 columnNumber, CancellationToken cancellationToken) in D:\a\_work\1\s\src\PowerShellEditorServices\Services\TextDocument\Handlers\CompletionHandler.cs:line 257 at Microsoft.PowerShell.EditorServices.Handlers.PsesCompletionHandler.Handle(CompletionParams request, CancellationToken cancellationToken) in D:\a\_work\1\s\src\PowerShellEditorServices\Services\TextDocument\Handlers\CompletionHandler.cs:line 91 | [Warn - 4:45:27 PM] Microsoft.PowerShell.EditorServices.Handlers.PsesCompletionHandler: Exception occurred while running handling completion request - System.Threading.Tasks.TaskCanceledException: A task was canceled. at Microsoft.PowerShell.EditorServices.Services.Symbols.AstOperations.GetCompletionsAsync(Ast scriptAst, Token[] currentTokens, Int32 fileOffset, IInternalPowerShellExecutionService executionService, ILogger logger, CancellationToken cancellationToken) in D:\a\_work\1\s\src\PowerShellEditorServices\Services\Symbols\Visitors\AstOperations.cs:line 141 at Microsoft.PowerShell.EditorServices.Handlers.PsesCompletionHandler.GetCompletionsInFileAsync(ScriptFile scriptFile, Int32 lineNumber, Int32 columnNumber, CancellationToken cancellationToken) in D:\a\_work\1\s\src\PowerShellEditorServices\Services\TextDocument\Handlers\CompletionHandler.cs:line 257 at Microsoft.PowerShell.EditorServices.Handlers.PsesCompletionHandler.Handle(CompletionParams request, CancellationToken cancellationToken) in D:\a\_work\1\s\src\PowerShellEditorServices\Services\TextDocument\Handlers\CompletionHandler.cs:line 91 | [Warn - 4:46:57 PM] Microsoft.PowerShell.EditorServices.Handlers.PsesCodeActionHandler: textDocument/codeAction skipping diagnostic with empty Code field: PowerShell The '<' operator is reserved for future use. | [Warn - 4:47:08 PM] Microsoft.PowerShell.EditorServices.Handlers.PsesCompletionHandler: Exception occurred while running handling completion request - System.NullReferenceException: Object reference not set to an instance of an object. at Microsoft.PowerShell.EditorServices.Services.Symbols.AstOperations.GetCompletionsAsync(Ast scriptAst, Token[] currentTokens, Int32 fileOffset, IInternalPowerShellExecutionService executionService, ILogger logger, CancellationToken cancellationToken) in D:\a\_work\1\s\src\PowerShellEditorServices\Services\Symbols\Visitors\AstOperations.cs:line 141 at Microsoft.PowerShell.EditorServices.Handlers.PsesCompletionHandler.GetCompletionsInFileAsync(ScriptFile scriptFile, Int32 lineNumber, Int32 columnNumber, CancellationToken cancellationToken) in D:\a\_work\1\s\src\PowerShellEditorServices\Services\TextDocument\Handlers\CompletionHandler.cs:line 257 at Microsoft.PowerShell.EditorServices.Handlers.PsesCompletionHandler.Handle(CompletionParams request, CancellationToken cancellationToken) in D:\a\_work\1\s\src\PowerShellEditorServices\Services\TextDocument\Handlers\CompletionHandler.cs:line 91 | [Warn - 4:47:32 PM] Microsoft.PowerShell.EditorServices.Handlers.PsesCompletionHandler: Exception occurred while running handling completion request - System.NullReferenceException: Object reference not set to an instance of an object. at Microsoft.PowerShell.EditorServices.Services.Symbols.AstOperations.GetCompletionsAsync(Ast scriptAst, Token[] currentTokens, Int32 fileOffset, IInternalPowerShellExecutionService executionService, ILogger logger, CancellationToken cancellationToken) in D:\a\_work\1\s\src\PowerShellEditorServices\Services\Symbols\Visitors\AstOperations.cs:line 141 at Microsoft.PowerShell.EditorServices.Handlers.PsesCompletionHandler.GetCompletionsInFileAsync(ScriptFile scriptFile, Int32 lineNumber, Int32 columnNumber, CancellationToken cancellationToken) in D:\a\_work\1\s\src\PowerShellEditorServices\Services\TextDocument\Handlers\CompletionHandler.cs:line 257 at Microsoft.PowerShell.EditorServices.Handlers.PsesCompletionHandler.Handle(CompletionParams request, CancellationToken cancellationToken) in D:\a\_work\1\s\src\PowerShellEditorServices\Services\TextDocument\Handlers\CompletionHandler.cs:line 91 | [Warn - 4:47:56 PM] Microsoft.PowerShell.EditorServices.Handlers.PsesCompletionHandler: Exception occurred while running handling completion request - System.NullReferenceException: Object reference not set to an instance of an object. at Microsoft.PowerShell.EditorServices.Services.Symbols.AstOperations.GetCompletionsAsync(Ast scriptAst, Token[] currentTokens, Int32 fileOffset, IInternalPowerShellExecutionService executionService, ILogger logger, CancellationToken cancellationToken) in D:\a\_work\1\s\src\PowerShellEditorServices\Services\Symbols\Visitors\AstOperations.cs:line 141 at Microsoft.PowerShell.EditorServices.Handlers.PsesCompletionHandler.GetCompletionsInFileAsync(ScriptFile scriptFile, Int32 lineNumber, Int32 columnNumber, CancellationToken cancellationToken) in D:\a\_work\1\s\src\PowerShellEditorServices\Services\TextDocument\Handlers\CompletionHandler.cs:line 257 at Microsoft.PowerShell.EditorServices.Handlers.PsesCompletionHandler.Handle(CompletionParams request, CancellationToken cancellationToken) in D:\a\_work\1\s\src\PowerShellEditorServices\Services\TextDocument\Handlers\CompletionHandler.cs:line 91 |

Created at 2 hours ago
Created at 2 hours ago
issue comment
Wait-Process -InputObject $P where $P= Start-Process with credentials, Passtru and no -Wait results is Access Denied

It is, the process object you get back from Start-Process is very limited in what you can do as your user does not have permissions to work with that token.

The same .Net problem were mentioned as the background reason for the -Wait problem on the start-process, but that was solved, so why can these issues not be solved used the same (interrnal) technique?

Using Start-Process -Credential ... -Wait was solved because internally it still had access to the full process token where it could do things like wait until it was done ("synchronization rights"). Unfortunately that full process token is discarded and dotnet has no way to say hey give me a System.Diagnostics.Process object from that process handle. It is forced to use [System.Diagnostics.Process]::GetProcessById($newProcId) to get a new process object but now it's subject to the same access checks that user normally would have when inspecting other processes.

The ultimately fix is to stop doing the work manually in Start-Process to spawn the new process and just use the dotnet API directly. This was not possible before as dotnet didn't expose all the options that pwsh has but with the merging off https://github.com/dotnet/runtime/pull/82662 it should now be possible to do so.

Created at 2 hours ago
Compress-Archive is stripping UNIX file permissions

It's worth noting that from pwsh 7.3, when this started being build for .NET 7, I think Compress-Archive should have started applying some default permissions (defined here), and that does seem to have been my experience, tested in WSL2.

Created at 3 hours ago
Created at 3 hours ago
issue comment
Wait-Process -InputObject $P where $P= Start-Process with credentials, Passtru and no -Wait results is Access Denied

I do not agree that it is a duplicate. Perhaps the background reason is the same .Net issue but it are completely different powershell issues. The same .Net problem were mentioned as the background reason for the -Wait problem on the start-process, but that was solved, so why can these issues not be solved used the same (interrnal) technique?

Created at 3 hours ago
Created at 3 hours ago

Update CHANGELOG for v2023.3.2-preview

Bump version to v2023.3.2-preview

Created at 3 hours ago

Update CHANGELOG for v3.8.3

Bump version to v3.8.3

Created at 3 hours ago
Created at 3 hours ago
Created at 3 hours ago
pull request opened
Release `v2023.3.2-preview`

Automated PR for new release!

Created at 3 hours ago

Merge pull request #4461 from PowerShell/release

Release v2023.3.1-preview

Bump typescript from 4.9.5 to 5.0.2 (#4468)

Bumps typescript from 4.9.5 to 5.0.2.


updated-dependencies:

  • dependency-name: typescript dependency-type: direct:development update-type: version-update:semver-major ...

Signed-off-by: dependabot[bot] support@github.com Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

Bump esbuild from 0.17.11 to 0.17.12 (#4467)

Bumps esbuild from 0.17.11 to 0.17.12.


updated-dependencies:

  • dependency-name: esbuild dependency-type: direct:development update-type: version-update:semver-patch ...

Signed-off-by: dependabot[bot] support@github.com Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

Bump @typescript-eslint/eslint-plugin from 5.55.0 to 5.56.0 (#4465)

Bumps @typescript-eslint/eslint-plugin from 5.55.0 to 5.56.0.


updated-dependencies:

  • dependency-name: "@typescript-eslint/eslint-plugin" dependency-type: direct:development update-type: version-update:semver-minor ...

Signed-off-by: dependabot[bot] support@github.com Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

Remove references to separate preview extension

Better validate version string in release tools

Remove preview label from marketplace

We were using this as an easy way to determine if the version is a pre-release. However, the marketplace always looks a the latest version meaning it was placing a "preview" label and our preview icon on the webpage.

So we had to write a different way to determine if the extension is a pre-release.

Move version functions to separate module

So the GitHub module isn't required.

Split build and test CI so PowerShell Core can be used for the former

Since it's required in order to use our version tools.

Allow preview suffix for PowerShellEditorServices too

Since I do actually plan to use it to preview a PSReadLine preview.

Address feedback

Merge pull request #4464 from PowerShell/andschwa/no-preview

Remove preview label from marketplace

Bump @typescript-eslint/eslint-plugin from 5.56.0 to 5.57.0 (#4476)

Bumps @typescript-eslint/eslint-plugin from 5.56.0 to 5.57.0.


updated-dependencies:

  • dependency-name: "@typescript-eslint/eslint-plugin" dependency-type: direct:development update-type: version-update:semver-minor ...

Signed-off-by: dependabot[bot] support@github.com Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

Bump esbuild from 0.17.12 to 0.17.14 (#4480)

Bumps esbuild from 0.17.12 to 0.17.14.


updated-dependencies:

  • dependency-name: esbuild dependency-type: direct:development update-type: version-update:semver-patch ...

Signed-off-by: dependabot[bot] support@github.com Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

Bump @typescript-eslint/parser from 5.55.0 to 5.57.0 (#4477)

Bumps @typescript-eslint/parser from 5.55.0 to 5.57.0.


updated-dependencies:

  • dependency-name: "@typescript-eslint/parser" dependency-type: direct:development update-type: version-update:semver-minor ...

Signed-off-by: dependabot[bot] support@github.com Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

Bump sinon from 15.0.2 to 15.0.3 (#4478)

Bumps sinon from 15.0.2 to 15.0.3.


updated-dependencies:

  • dependency-name: sinon dependency-type: direct:development update-type: version-update:semver-patch ...

Signed-off-by: dependabot[bot] support@github.com Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

Remove problematic [RepoNames] PowerShell class (#4481)

It was admittedly over-engineered and caused problems since PowerShell classes aren't imported across modules.

Instead just use ValidateSet directly wherever the command is either use-facing or switches on the string directly.

Update CHANGELOG for v2023.3.2-preview

Bump version to v2023.3.2-preview

Created at 3 hours ago
Release `v3.8.3`

Automated PR for new release!

Created at 3 hours ago

Update CHANGELOG for v3.8.3

Bump version to v3.8.3

Created at 3 hours ago

Merge pull request #2007 from PowerShell/release

Release v3.8.2

Update build documentation to include platyPS requirement

Since it's always used post-build to generate the documentation, we have a #requires for it but forgot to add it to the documentation.

Also suppress stderr for sysctl when checking if macOS is an Intel or Arm processor. On the former, it doesn't know what field we're querying.

Bump Emacs version in GitHub action and install updated packages

Now using use-package to better install them, and setting load-prefer-newer which was probably the bug.

Merge pull request #2008 from PowerShell/andschwa/x64-macOS

Update build documentation to include platyPS requirement

Created at 3 hours ago
Created at 3 hours ago
andschwa delete branch andschwa/validateset
Created at 3 hours ago

Remove problematic [RepoNames] PowerShell class (#4481)

It was admittedly over-engineered and caused problems since PowerShell classes aren't imported across modules.

Instead just use ValidateSet directly wherever the command is either use-facing or switches on the string directly.

Created at 3 hours ago
pull request closed
Remove problematic `[RepoNames]` PowerShell class

It was admittedly over-engineered and caused problems since PowerShell classes aren't imported across modules.

Instead just use ValidateSet directly wherever the command is either use-facing or switches on the string directly.

Created at 3 hours ago
Microsoft.Extensions.Logging.Abstractions Error in vscode only.

Interestingly they have an AlcWrapper in their source...but yeah I don't see it in use for Az.IotHub.

@justcain-ok I'll be at PSConfEU this year if you happen to be there!

Created at 3 hours ago
Microsoft.Extensions.Logging.Abstractions Error in vscode only.

Sure looks to me like the Azure module developers implemented an AssemblyLoadContext for their Accounts module...and nothing else, looking at this search: https://github.com/search?q=repo%3AAzure%2Fazure-powershell+AssemblyLoadContext+path%3A%2F%5Esrc%5C%2F%2F+language%3AC%23&type=code&l=C%23

I browsed through the Az.IotHub module's sources in that same repo and it sure enough depends on a conflicting version of Microsoft.Extensions.Logging.Abstractions.dll, and does not have an ALC to isolate it 🥲

Created at 3 hours ago
pull request opened
Remove problematic `[RepoNames]` PowerShell class

It was admittedly over-engineered and caused problems since PowerShell classes aren't imported across modules.

Instead just use ValidateSet directly wherever the command is either use-facing or switches on the string directly.

Created at 4 hours ago

Remove problematic [RepoNames] PowerShell class

It was admittedly over-engineered and caused problems since PowerShell classes aren't imported across modules.

Instead just use ValidateSet directly wherever the command is either use-facing or switches on the string directly.

Created at 4 hours ago