559 questions
0
votes
0
answers
9
views
Error when showing Windows Forms window second time and on
I'm using PowerShell 7.6.0-preview.4 and VS Code.
I created simple Windows Forms form and try to show it:
Write-Host "Running WinForms form..."
Add-Type -AssemblyName System.Windows.Forms
[...
1
vote
1
answer
35
views
write-progress not working with multiple progress activities in PS 7.x
This script works correctly in Powershell 5.1, but not in 7.4.7. In 7, it only shows the progress indicator for the first activity, but not the second. Can anyone see how I can fix that, or is it a ...
0
votes
1
answer
37
views
Command "Use PowerShell" in Azure DevOps
Azure DevOps has a UseDotNet@2 command which download and use specific/latest .NET Core runtime or SDK or both, the same function DevOps has for Python and Ruby.
This is very useful in case you have ...
0
votes
2
answers
37
views
In pwsh, build url string with environment variables
In pwsh, how can I form a URL string (with both host and port) for a command line argument?
The following...
$env:SITE_HOST = 'www.google.com'
$env:SITE_PORT = '443'
curl https://$env:SITE_HOST:$env:...
2
votes
1
answer
52
views
Path of ResourceDictionary for WPF in PowerShell
Dear WPF & PowerShell Pros,
I am working on a PowerShell (Core, 7) module that shall have a WPF GUI.
I want to organize the code in a better way, splitting up the XAML, e.g. Styles.xaml, Colors....
2
votes
2
answers
50
views
How to pass array of strings as param from function to get-process/where-object
I'm trying to write a function so I can pass an array of strings as a parameter that is being used by get-process | where-object but It's not matching how I want. The code below kinda shows what I'm ...
0
votes
0
answers
44
views
Powershell XAML with variables to load combobox
I have an XAML form to get a list of servers and allow me to remotely get the list of processes running on them and stop them. This works fine if I hard code the names in the xml here string but I ...
0
votes
0
answers
47
views
Unable to understand RPC_E_SERVERFAULT Error
I have a PowerShell Script that cycles through multiple Excel Workbooks, runs a few VBA routines, and then closes.
Unfortunately, I get the following error :
Exception calling "Run" with &...
0
votes
1
answer
46
views
"InvalidOperation: Unable to find type [Azure.Response]." in Azure PS script
I'm writing a script using Azure PS and I am used to typing all variables explicitly as it helps me avoid surprises. I found that when I type the variables storing results of API calls returning Azure....
0
votes
0
answers
15
views
Prevent PowerShell from enclosing parameters with spaces in quotes
Given the following setup:
$msbuild = 'c:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\amd64\MSBuild.exe'
$props = 'Prop1=value1;Prop2="value 2"'
how do I make ...
0
votes
0
answers
19
views
PowerShell Binary Module Dependencies
If I publish my C# Binary PowerShell module like this, it works.
dotnet publish -c Release
Push-Location ".\Module\bin\Release\net7.0\publish"
Publish-Module -Name .\ImportIcal.psd1 -...
1
vote
1
answer
45
views
What is ScopedItemOptions?
I've read some discussion on github metioned that Item cmdlets have Options. The only documentation I found is this
Are options only specific to Item cmdlets?
What are these dedicated options for? To ...
1
vote
3
answers
71
views
Can't create an array containing a single array in PowerShell 7 (Core)
I can create arrays containing multiple arrays.
Example:
@(@('a', 'b'), @('c', 'd')) returns @(@('a', 'b'), @('c', 'd'))
But an array containing a single array is automatically flattened.
Example:
@(@(...
1
vote
1
answer
95
views
I am trying to execute a main powershell script from v5.1 to v7 and continue
I have these files that talk to each other, i have other functions in the module file but i can't get it past the restart in v7.
here is my script root directory
PS C:\Users\user\Desktop\New folder>...
0
votes
1
answer
150
views
Command segment in .omp.json Oh-my-posh theme
I've been modifying to my taste, the theme kali, from oh my posh.
I encountered the following problem.
I have this segment
{
"type": "prompt",
"alignment": "left&...