Michael Klement

Results 1234 comments of Michael Klement

.NET 7+ is not supported on Windows 7 (which [itself is no longer supported](https://www.microsoft.com/en-us/windows/end-of-support?r=1)). PowerShell 7.2.x is the latest version (itself now [no longer supported](https://learn.microsoft.com/en-us/powershell/scripting/install/powershell-support-lifecycle?view=powershell-7.5#powershell-end-of-support-dates)) that is built on a...

@iSazonov, other than that, it LGTM. Thanks your tackling this, @GameMicrowave.

The problem goes away if you use `InitialSessionState.CreateDefault2();` instead. The method's [help topic](https://learn.microsoft.com/en-us/dotnet/api/system.management.automation.runspaces.initialsessionstate.createdefault2) states tersely (emphasis added), "The default cmdlets, provider, etc are _loaded via Modules_", and the use of...

@jborean93, agreed re docs. I haven't dug into the source code, but it's easy to demonstrate the difference between `.CreateDefault()` (no `.Path` property) and `.CreateDefault2()` (`.Path` property present) as follows:...

You can also verify the difference in module-loading behavior (which happens on demand) as follows: ```powershell [pscustomobject] @{ 'Modules loaded after Get-Acl call with CreateDefault' = [powershell]::create([initialsessionstate]::CreateDefault()).AddScript('Get-Acl c:\windows | Out-Null;...

Thanks for the explanation, @jborean93. Given that snap-ins are long obsolete, I think it's clear that we're dealing with legacy behavior. Thus, adding a (soft-)deprecation note to the `.CreateDefault()` help...

See also: * https://github.com/PowerShell/PowerShell/issues/13664#issuecomment-770407724

What seems to be happening currently: * What `Write-Host` (and `Write-Information`) outputs are [`System.Management.Automation.InformationRecord`](https://learn.microsoft.com/en-US/dotnet/api/System.Management.Automation.InformationRecord) instances. For `Write-Host` output, these instances _do_ store original formatting instructions such as `-ForegroundColor` and `-NoNewLine`,...

Great idea, @iRon7. As with any introduction of a new common parameter, breaking existing scripts that use the same parameter name for custom purposes is a concern, and a quick...

@iRon7: Good idea; `-SplatParameters` seems like a better choice (I'd definitely keep the word "splat" in there), as the "PS" prefix has no precedent among the common parameters; `-SplatParameters` too...