Questions tagged [powershell-7.3]
62 questions
45
votes
1 answer
Powershell 7.3.0 Tab completion not working
I've recently upgraded PowerShell to version 7.3.0 version and now, when I type a command, I see its suggestions like when I'm typing pip it adds list like in this image. Or when I type start of the command it suggests its full name.
The problem is…

Slakter
- 553
- 4
- 7
10
votes
1 answer
PowerShell 7.3.0 breaking command invocation
I use WinSCP within a Powershell script. It suddenly stopped working. After a while I could figure out that the problem appeared from a more recent version of PowerShell:
Reduced code:
& winscp `
/log `
/command `
'echo…

JFFIGK
- 632
- 1
- 7
- 24
8
votes
1 answer
How to change the Suggestion completion key on Powershell 7.3.0?
Recently I updated my PowerShell to version 7.3.0 and when typing it shows suggestions. But when I press the Tab key it doesn't autocomplete the suggestion. How to set the Tab as the autocompletion key?

NirmalCode
- 2,140
- 1
- 14
- 19
4
votes
1 answer
PrintOut Code Works On PowerShell v 5.1, But Not On 7.3
I am trying to print parts of several docx files. The code below works in Windows PowerShell 5.1, but not in PowerShell 7.3. I would like to understand why and help updating the code so it works in PowerShell 7.3.
$path =…

mwb9aa
- 41
- 2
3
votes
2 answers
How to get the TBS (To be signed) value of a signed file in PowerShell?
Looking for a way to get the TBS of a file that has digital signature in PowerShell 7.3+
Tried a few things like:
add-type -AssemblyName system.security.cryptography.X509Certificates
$cert = new-Object…

SpyNet
- 323
- 8
3
votes
0 answers
Why can't I populate strongly-typed dictionaries with ForEach-Object unless the input object is provided via pipeline (rather than parameter)?
Context
I'm aiming to gather info about the user's Java Runtime Environment in a script for use in checking that it meets certain requirements. I start with a variable named JRE that's cast as a list of strings, which becomes populated with info…

Magic Spearmint
- 31
- 2
3
votes
2 answers
How to serialize/deserialize data back and forth between Windows PowerShell and PowerShell core?
I've been trying to find a solution to work with a specific cmdlet from ConfigCi built-in module that is incompatible with PowerShell core. The cmdlet is New-CIPolicyRule
I want to use it in my module that targets PowerShell 7.3+.
Here is the…

SpyNet
- 323
- 8
3
votes
1 answer
[System.IO.Path]::GetTempPath() outputs local temp directory when called through Invoke-Command on a remote machine
I'm running PowerShell commands on a remote machine by the use of Invoke-Command -ComputerName. I'm trying to obtain the path of the temporary directory of the remote machine.
Depending on where I call [System.IO.Path]::GetTempPath() it either…

zett42
- 25,437
- 3
- 35
- 72
3
votes
1 answer
Sort-Object: Can it use an object's method result for sorting?
Using Add-Member I added a tiny method to an array of objects to calculate sort of a hash from a string:
$arr | Add-Member -MemberType ScriptMethod -Name 'SortedName' -Value {
[string]$name = $this.Name
[int]$start = [int][char]$name[0];
…

AxD
- 2,714
- 3
- 31
- 53
2
votes
1 answer
How to support multiple, mutually exclusive parameters?
I must write a script to get instances of Thing.
Each Thing contains an event timestamp.
I need to allow the user to specify a timestamp range.
There are four (4) time-specifying parameters
None are mandatory
$Since and $StartTimestamp are mutually…

lit
- 14,456
- 10
- 65
- 119
2
votes
3 answers
In PowerShell, how can I create a scheduled task that runs only 1 time at startup and then deletes itself?
This is what I've gathered so far. I need a scheduled task that runs only 1 time, at the next startup (whenever that is) and after it runs it should delete itself.
Register-ScheduledTask -TaskName "Test 1" -InputObject (
(
…

SpyNet
- 323
- 8
2
votes
1 answer
How do I declare/use a strongly typed predicate function as Cmdlet parameter?
I found a number of answers on how to use a script block as Cmdlet parameter, but I couldn't find an answer on how to declare and use a strongly typed predicate function, i.e. something like a .NET Func delegate.
I tried the following,…

AxD
- 2,714
- 3
- 31
- 53
2
votes
1 answer
How can I use $_ in a PowerShell scriptblock in Ansible?
I want to execute some PowerShell code on Linux via Ansible without outsourcing it to a file. I am using the following multiline string command, which works great in general, but does not work as expected as soon as I try to access the current…

stackprotector
- 10,498
- 4
- 35
- 64
2
votes
1 answer
How can I pipe to a PowerShell script residing in a path with spaces?
I wrote a PowerShell script that's accepting input from the pipeline plus some parameters.
Now, when I want to call the script from another directory, the following doesn't work:
Get-ChildItem | 'D:\My Documents\PowerShell\My-Script.ps1' -MyParam 1…

AxD
- 2,714
- 3
- 31
- 53
2
votes
1 answer
ssh not recognised in Powershell 7
ssh command can used in windows powershell which is system build-in,it like this:
ssh in powershell
But when I use is in powershell7 which i download in github,ssh command do not work,it like this:
ssh in powershell7
how I can solve it, I do not…

Tsieyy
- 29
- 1