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.
Questions tagged [powershell-7.0]
216 questions
0
votes
1 answer
Is there a way to make VBA as a standard open PowerShell 7.3.6.0?
Running the following VBA code opens PowerShell v1, and computes size remaining on DriveLetter C.
Sub RunPowershell()
Set wShell = CreateObject("WScript.Shell")
Set wShellResult = wShell.Exec("powershell (Get-Volume -DriveLetter…

96ask
- 1
0
votes
0 answers
Error when running application with PowerShell version 7: "Get-ExecutionPolicy" command not found
Description:
I encountered an error while running my application with PowerShell version 7. The error message states:
Get-ExecutionPolicy: The 'Get-ExecutionPolicy' command was found in the module 'Microsoft.PowerShell.Security', but the module…

Abhijay007j
- 888
- 6
- 13
0
votes
1 answer
SmbShare: the module could not be loaded
The Problem:
I have inherited a PS script file that deletes a directory. In case there are any locks on it, it removes them using this line:
Get-SmbOpenFile | Where-Object -Property Path -Like "$($Directory)*" | Close-SmbOpenFile -Force
This works…

nvoigt
- 75,013
- 26
- 93
- 142
0
votes
1 answer
How to parse a table in TXT
I have a bunch of Log files (saved as .txt) that contain a 'table' at the end of each log that I need to parse.
What do I mean by 'table'?
Total Copied Skipped Mismatch FAILED Extras
Dirs : 332 332 332 …

Tim Shegrud
- 3
- 1
0
votes
1 answer
Using ForEach-Object -Parallel on multiple Servers with Get-NetFirewallRule
I am writing a code which is checking the firewall rules from multiple servers. Since we have alot servers here, i want to run my Script parallel on these servers. My script is kind of working. I get 510 firewall rules. Sadly its prints always the…

Predator1403
- 1
- 1
0
votes
0 answers
Powershell transcript for powershell 7
I've migrated to powershell 7 recently, but I can't make the powershell transcription working for powershell 7. (Legacy powershell transcription works fine though.)
The registry is…

TaihouKai
- 133
- 11
0
votes
0 answers
Trying to change a path inside an .m3u Playlist
I have a lot of Playlist files (.m3u) created on one system that I need to move to another system. The files reference the original location which I need to change to a new location on a different system. I have been using PowerShell7 and a command…

Don Vitz
- 1
- 1
0
votes
0 answers
Get-MgUserCalendar only works if I have delegate permissions in O365
When calling Get-MgUserCalendar I get an error "The specified object was not found in the store." unless I have given myself delegate permissions on that person's mailbox. I am a global admin in O365. The purpose of my script is to forcibly add an…

FloorPills
- 21
- 3
0
votes
1 answer
How to interact with Azure AD B2C custom User Attributes via Microsoft Graph PowerShell SDK?
I have added a custom User Attribute named Company Name via:
Azure AD B2C > User attributes
so that this information can be returned in the identity token after successful sign in.
I want to update these values for each user in the Azure AD B2C…

user1063287
- 10,265
- 25
- 122
- 218
0
votes
0 answers
Why does the IndexOf() method give me an error when the documentation states that it should work?
I'm looking to parse out a specific blob of text to a different file. However, I'm having an issue with the .IndexOf() method when trying to define my endIndex.
The string I'm looking for will start with the phrase:
/* original invocation */
It…
0
votes
1 answer
PowerShell 5 (now updated to 7) - Check if multiple levels / depths of subfolders exists and if so move its contents up one level
Normally I wouldn't even post without some framework together, but I'm stumped on where to begin.
I have a directory of hundreds of subfolders that should only be one level deep but some are two levels…

user602214076
- 23
- 5
0
votes
1 answer
ForEach -parallel processing sorted data
I am trying to process a bunch of files (hash them) from a Directory in parallel, but need the results to keep the order the inputs have.
Get-ChildItem -Recurse -Force -File `
| Sort-Object -Property 'FullName' `
| % -ThrottleLimit 10 -Parallel {…

Simon
- 1,172
- 12
- 21
0
votes
0 answers
jPowerShell and PowerShell Core (7.x) Issue
I am trying to invoke PowerShell cmdlets and scripts from a Java Application. I am using jPowerShell . It works as expected as expected with PowerShell version 6.0.x. However, when I am running PowerShell 7.x, the executeCommand() method times out.…
0
votes
1 answer
How to prompt for UAC in PowerShell 7 and save the entered password as variable?
I have a simple script to create a scheduled task like this:
$action = New-ScheduledTaskAction -Execute "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -Argument '-file "File.ps1"'
$trigger = New-ScheduledTaskTrigger…
user20682592
0
votes
1 answer
Get-MessageTrace producing inconsistent results
I have a powershell script running the following line of code:
$results = Get-MessageTrace -SenderAddress $senderEmail -StartDate $daysAgo -EndDate $todayDate
A new employee tries to run this and gets no results in the message trace. When we remove…

FloorPills
- 21
- 3