Questions tagged [powershell-7.0]

Use this tag for version specific questions about Windows PowerShell version 7.0. When using this tag also include the more generic [powershell] tag where possible. For general PowerShell topics, use the [powershell] tag.

216 questions
1
vote
1 answer

how do I use powershell variable in AWS CLI command

I am trying to run AWS CLI in Powershell 7 with a JSON string as parameter. AWS docs make it seem straightforward: aws route53 ... --change-batch '{"Changes":[{"Action":"UPSERT"}]}' however, I get an error: Error parsing parameter…
Felix
  • 9,248
  • 10
  • 57
  • 89
1
vote
2 answers

Error when using powershell 7 foreach-object -parallel and AWS S3 module to download S3 folder content

I have the following basic AWS powershell script downloading all of the content of an S3 bucket folder. Get-S3Object -BucketName $s3BucketName -keyPrefix $keyPrefix | Read-S3Object -Folder "C:\temp\Events\" Unfortunately, it runs too slow as the…
1
vote
1 answer

Optimize function creation and subsequent autocomplete configuration with a hash table

Primary Question My question is whether it is possible to optimize the creation of functions and subsequent autocomplete settings with a hash table. The Functions I want to optimize e.g. with a ForEach over the hash table below: Function…
1
vote
0 answers

How to retrieve SVN files listing from PowerShell?

How can I retrieve the list of files from a given SVN repository from PowerShell? For the sake of demonstration, let's assume svn://example.com/repo is the path to my repository. I can do it directly from the console (both the regular Windows…
O. R. Mapper
  • 20,083
  • 9
  • 69
  • 114
1
vote
2 answers

How to retrieve Azure Service Principal's secret in Powershell 7

I recently started using PowerShell 7.x and I've came around some problems. I am not able to retrieve the secret of my service principal when I create it through PowerShell 7. The return body does not give the "Secret" property. I used to work with…
1
vote
1 answer

Powershell script to delete Microsoft Team

I am working on a script to remove a Microsoft team in a tenant using remove-team. How would I go about putting the output of get-team into menu options for the user to choose which team to delete? Would I need to put all of the teams in an array…
Derek
  • 37
  • 5
1
vote
1 answer

Why does ($false || $true) evaluate to False in Powershell 7+?

In Powershell 7.2 Write-Output ($false || $true) will output False. Why?
1
vote
1 answer

Convertfrom-JSON assistance

I am trying to put together a script to create a Microsoft Team from a JSON file. I am trying to understand Convertfrom-JSON and how I can pipe the object into creating a new team with channels and users. I can view the object by entering in…
Derek
  • 37
  • 5
1
vote
2 answers

Azure Automation Hybrid-Worker Get-AutomationPSCredential for PowerShell 7

We are moving a few Azure Automation Hybrid-worker scripts to PowerShell 7.1. In doing so one of the commands that work in PowerShell 5.1 is: [PSCredential] $AutomationCredential = Get-AutomationPSCredential -Name 'abcdef'. When we try the same…
1
vote
0 answers

Powershell $PROFILE points to an invalid location in Windows

I have my PowerShell profile all set up with custom modules and stuff. But the $PROFILE points to an invalid location. PS C:\Users\akris>…
Krissh
  • 67
  • 1
  • 7
1
vote
1 answer

Does PowerShell automatically convert pipeline objects to strings as needed?

The help for Split-Path states that the parameters -LiteralPath and -Leaf are incompatible: SYNTAX Split-Path [-Path] -Leaf [-Resolve] # ... Split-Path -LiteralPath [-Resolve] # ... This command…
MarredCheese
  • 17,541
  • 8
  • 92
  • 91
1
vote
1 answer

Checking if a string can/cannot be converted to int/float

I am using PowerShell 7.1.4 and I wanna check if a string can be converted to a number. Something like: $age = Read-Host "age" if(![int]$age) { Write-Host "$age is not a number" } I came from JavaScript so don't mind the "!" if its wrong, and…
invisible boi
  • 106
  • 1
  • 8
1
vote
2 answers

Rename-Item fails with 'Cannot rename because item at 'C:\Folder\ Example App Folder ' does not exist

I have a folder that has 100s of subfolders and files within those subfolders that have names with leading and trailing spaces. These folders and files were created using a Node JS app. I need to now remove the leading and trailing spaces from the…
1
vote
1 answer

How to remove recourses from ARM template using PowerShell?

{ "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": { "Connection1Name": { "type": "string", "defaultValue":…
Kraken194
  • 53
  • 9
1
vote
3 answers

can't run this command from outside of powershell7, default powershell works

{Oh if possible I don't want to use powershell} I've a pc where powershell default is broken so I'm forced to use ps7, if I run this import subprocess import os powershell = '' if os.path.isfile('C:/Program Files/PowerShell/7/pwsh.exe'): …
WoLvES 2.0
  • 41
  • 5