powershell-core

Using both desktop Powershell 5.1 and Powershell Core 6.1

狂风中的少年 提交于 2019-12-08 06:42:44
问题 I was playing with PS.Core 6.1 in my VS Code - made it the default shell, opened PS debugging sessions with it, opened its console, etc ... Now I am opening the regular desktop Powershell 5.1 and get this: Windows PowerShell Copyright (C) Microsoft Corporation. All rights reserved. PS C:\Users\me> get-module ModuleType Version Name ExportedCommands ---------- ------- ---- ---------------- Manifest 6.1.0.0 Microsoft.PowerShell.Utility {Add-Member, Add-Type, Clear-Variable, Compare-Object...}

windows core run command with elevated privileges

淺唱寂寞╮ 提交于 2019-12-06 22:05:42
There are a few options for standard user to run as Administrator (or any another user), however, even when logged as Administrator, some functions requires to run 'elevated'. On a windows gui, just right click a .exe and select run as Administrator or even elevate 'cmd' or 'powershell'. How can you get elevated privileges on Windows core? Generally, to programmatically invoke an executable with elevation (Run as Administrator) on Windows, use the Start-Process cmdlet with -Verb RunAs . This applies equally to pwsh.exe , the PowerShell Core executable, so that in the simplest case you can

Using both desktop Powershell 5.1 and Powershell Core 6.1

混江龙づ霸主 提交于 2019-12-06 16:26:46
I was playing with PS.Core 6.1 in my VS Code - made it the default shell, opened PS debugging sessions with it, opened its console, etc ... Now I am opening the regular desktop Powershell 5.1 and get this: Windows PowerShell Copyright (C) Microsoft Corporation. All rights reserved. PS C:\Users\me> get-module ModuleType Version Name ExportedCommands ---------- ------- ---- ---------------- Manifest 6.1.0.0 Microsoft.PowerShell.Utility {Add-Member, Add-Type, Clear-Variable, Compare-Object...} Script 2.0.0 PSReadline {Get-PSReadLineKeyHandler, Get-PSReadLineOption, Remove-PS... PS C:\Users\me>

How to parse html in Powershell Core

梦想与她 提交于 2019-12-05 23:08:00
So, Invoke-WebRequest in Powershell Core is permanently baked with -UseBasicParsing . More details can be found here and here . Net result - no ParsedHtml property on the result object. While the rationale makes perfect sense, the question is - how to parse HTML in Powershell Core? Now, I can probably use a .NET Core library, like HtmlAgilityPack , but it seems like vast code changes would be required to migrate existing PS code to use this library. Is this our best option or are there any better ones for PS Core users? 来源: https://stackoverflow.com/questions/56777597/how-to-parse-html-in

PowerShell ISE: how to run new PowerShell version

陌路散爱 提交于 2019-12-05 02:01:26
How can I get PowerShell ISE to work with PowerShell 6.0. Currently, it has 4.0. This server has PowerShell 4.0 installed and I installed PowerShell 6.0 with PowerShell-6.1.0-win-x64.msi from this link: https://github.com/PowerShell/PowerShell/releases The files now exist in C:\Program Files\PowerShell\6. However, ISE still shows 4.0, but I need it to run 6.0 $PSVersionTable.psversion Major Minor Build Revision 4 0 -1 -1 postanote PowerShell has 3 executables... Windows only... PowerShell_ISE.exe = ISE v2 - v5.1 powershell.exe = consolehost v1 - 5.1 Note: (there are no new versions coming, but

What Library for Powershell 6 contains the get-wmiobject command?

穿精又带淫゛_ 提交于 2019-12-03 22:06:38
问题 I am getting the following error upon attempting to use the get-WmiObject command in PowerShell (version 6): PS C:\Users\zsofi> Get-WmiObject Win32_product | select name, packagecache Get-WmiObject : The term 'Get-WmiObject' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1 + Get-WmiObject Win32_product | select name, packagecache + ~~

PowerShell remoting: Controlling what edition is being targeted (PowerShell Core or Windows PowerShell); the state of cross-platform remoting

跟風遠走 提交于 2019-12-01 13:38:48
This self-answered question, which focuses on Windows [1] , addresses the following aspects: Now that there are two PowerShell editions - the legacy, Windows-only Windows PowerShell and the cross-platform PowerShell Core , both may be installed on a given Windows machine: How can I tell which PowerShell edition will execute remote commands , such as via Invoke-Command -ComputerName ? How can I target a specific edition , both ad hoc and persistently , through configuration? Note: For an edition to be targetable via remoting on a given machine, it must be set up for remoting : Only Windows

PowerShell remoting: Controlling what edition is being targeted (PowerShell Core or Windows PowerShell); the state of cross-platform remoting

橙三吉。 提交于 2019-12-01 10:47:26
问题 This self-answered question, which focuses on Windows [1] , addresses the following aspects: Now that there are two PowerShell editions - the legacy, Windows-only Windows PowerShell and the cross-platform PowerShell Core , both may be installed on a given Windows machine: How can I tell which PowerShell edition will execute remote commands , such as via Invoke-Command -ComputerName ? How can I target a specific edition , both ad hoc and persistently , through configuration? Note: For an

What Library for Powershell 6 contains the get-wmiobject command?

末鹿安然 提交于 2019-12-01 00:27:36
I am getting the following error upon attempting to use the get-WmiObject command in PowerShell (version 6): PS C:\Users\zsofi> Get-WmiObject Win32_product | select name, packagecache Get-WmiObject : The term 'Get-WmiObject' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1 + Get-WmiObject Win32_product | select name, packagecache + ~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (Get-WmiObject:String) [], CommandNotFoundException +