Skip to main content
Filter by
Sorted by
Tagged with
0 votes
2 answers
203 views

I'm trying to run a remote command using Invoke-Command over WSMan in PowerShell on my local machine. Here’s my test script: $server = 'localhost' Invoke-Command -Authentication Negotiate -...
Victor Sanchez's user avatar
4 votes
2 answers
99 views

I am using Set-StrictMode and $ErrorActionPreference Set-StrictMode -Version Latest $ErrorActionPreference = "Stop" $Foo = @{} $Foo["bar"] # No exception $Foo.bar # Exception as ...
GrandeKnight's user avatar
0 votes
0 answers
30 views

I have this snippet in a Powershell script, I can run the script on PSVersion 7.4.7 without error or problem, the git option gets set properly. $cmd = '"' + $mergeTool + '&...
J. M. Becker's user avatar
  • 2,873
2 votes
0 answers
92 views

I thought PowerShell is a dynamically-typed language because I can do this: $var = "1234" echo $var.GetType().Name # String $var = 1234 echo $var.GetType().Name # Int32 However, when I try ...
OriBeta's user avatar
  • 31
0 votes
1 answer
117 views

I wrote a script to add files to a document library within SharePoint. Pretty straightforward, however I now want to add that same file to a different document library depending on if certain criteria ...
DanielJ's user avatar
  • 107
1 vote
1 answer
70 views

Ex: I have a script that compares file information to a previously saved database file that has the same file information plus the calculated hash of each file. If the current file properties match ...
diytechy's user avatar
0 votes
1 answer
533 views

I am writing a script to export a template from a SharePoint site then uploading it to a different tenant. I am using PnP PowerShell library, and I am exporting the template using this command: Get-...
Marwan Summakieh's user avatar
0 votes
1 answer
72 views

All my parameter values are being received as empty in this seemingly straightforward function: function Get-SSH-Command { param ( [string]$private_key_path, [string]$user, ...
Michael B. Currie's user avatar
0 votes
1 answer
1k views

I have a server running Powershell 7.3.10 core and I need to upgrade to 7.4.2 which is the latest version my company supports. The problem is the server doesn't have winget on it and I can't find an ....
Cyber Phreax's user avatar
1 vote
0 answers
191 views

My app needs to execute PowerShell scripts to create and manage AD accounts. My current setup uses HangFire to launch background jobs, PowerShell execution being one of them. I have an ...
Wahab Chaudhry's user avatar
0 votes
1 answer
2k views

My main Script is Powershell 7, but i want to run a function in powershell 5 (because this function is only possible in powershell 5). I also want to give the function a psobject and return a psobject,...
ExactlyMe's user avatar
0 votes
1 answer
83 views

On running the dotnet --version or dotnet run command on Visual Studio or VSCode PowerShell, we are getting the Windows popup asking for App selection. Same issue doesn't occur on command prompt when ...
Ayush Patel's user avatar
0 votes
0 answers
65 views

I started writing a script to copy specific attributes from one AD-User and create a new User with those attributes and a different name. So far so well, it worked in the past. I deleted a codeblock ...
Niklas's user avatar
  • 5
0 votes
1 answer
134 views

The problem I have is that cmdlets are not exported and not imported. Consider following module example (.\Modules\Tools.psm1) Function Write-Message() { param ([String] $Message) Write-...
Thomas Lehmann's user avatar
2 votes
1 answer
196 views

I'm using Named Captures in PowerShell. But the following example is not returning all matches. All the lines in the following code return correct output - except the lines 7 and 8. I was expecting $...
nam's user avatar
  • 24.3k
2 votes
1 answer
398 views

I'm currently working with a script that utilizes the Invoke-Command over SSH as shown below. While it works well, I'm looking to implement exception handling, specifically for scenarios where the ...
Nanne's user avatar
  • 21
0 votes
0 answers
616 views

I have a strange issue and wonder if anyone has any ideas. I am trying to make a powershell script that can replace text in a word document. This script works fine on version 5 but not on version 7 ...
Jimmy Mc's user avatar
2 votes
1 answer
138 views

I have the following script: $ErrorActionPreference = "Stop" Install-Module 'DoesNotExist' -Force Write-Host "This should not be printed!" I'd assumed, that if an error occurs in ...
roli09's user avatar
  • 1,021
2 votes
1 answer
1k views

Trying to replace the default PowerShell Get-ChildItem command (mapped to ls by default in PowerShell 7) with eza, however I cannot seem to find anything on how to do so Using New-Alias results in ...
Madoka's user avatar
  • 23
1 vote
1 answer
763 views

I am trying to download a file from ftp but Invoke-WebRequest is not working. Since wget is not available on Powershell, I have to resort to use Invoke-WebRequest but I encountered this error: Invoke-...
mightyandweakcoder's user avatar
0 votes
1 answer
223 views

I want to remotely stop / start / restart SQlBrowser service from a .net core 6 application running on IIS that uses the Powershell 7 library. The application pool of the .net core service runs under ...
Jack McCauley's user avatar
0 votes
1 answer
235 views

Recently transitioned from PowerShell 5.1 to 7.3.6. Most scripts are fine, but there is one puzzling issue with a script calling a .NET class. The class can't load, crashing with this message: System....
Vadim Berman's user avatar
  • 2,061
0 votes
0 answers
232 views

I've tried this on a few systems so I think it's something with the module itself, but I'm not sure what to look for. Code Import-Module PSWriteHtml -UseWindowsPowerShell -WarningAction Ignore Error ...
swtto's user avatar
  • 251
1 vote
1 answer
233 views

I have a module that was written in PS5, and I'm adding a new function that requires PS7. I want to be able to run the function from PS5, so I'm thinking I can just have the function call pwsh, but I ...
swtto's user avatar
  • 251
1 vote
1 answer
130 views

I'm trying to retrieve the AD property LastLogon from each of our domain controllers, for each user. Due to the amount of time this will take, I'm trying to use the Parallel feature from PowerShell 7 ...
swtto's user avatar
  • 251
0 votes
1 answer
93 views

Running the following VBA code opens PowerShell v1, and computes size remaining on DriveLetter C. Sub RunPowershell() Set wShell = CreateObject("WScript.Shell") Set wShellResult = ...
96ask's user avatar
  • 1
3 votes
1 answer
168 views

In PSReadLine 2.2.2 for PowerShell 7.2.11, On Windows, you can also use the Alt+? key chord to show the function bound to the next key chord you enter. Conversely, is there a key or PS command that ...
Jason Doyle's user avatar
3 votes
0 answers
1k views

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 '...
Abhijay007j's user avatar
  • 1,128
1 vote
1 answer
341 views

I have a PowerShell script that listens for a key to be pressed before exiting. I accomplish this using a custom TypeDefinition; here's the code: param( [string]$quitKey = "F16" ) $...
ninbura's user avatar
  • 468
1 vote
3 answers
2k views

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 "$(...
nvoigt's user avatar
  • 77.8k
0 votes
1 answer
194 views

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 ...
Tim Shegrud's user avatar
0 votes
1 answer
253 views

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 ...
Predator1403's user avatar
0 votes
0 answers
438 views

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 this: Computer\...
TaihouKai's user avatar
  • 411
1 vote
2 answers
1k views

Trying to figure out why 3 powershell cmdlets are not working when using AWS SM Automation inputs Script, but they do work when running them in a local script directly on my Windows instances. The ...
humbleStrength's user avatar
-1 votes
1 answer
1k views

I have to invoke POST METHOD from powershell function which is having 8-9 parameters and these parameter may contain big strings. I am calling powershell function from Azure DevOps Yaml based ...
F11's user avatar
  • 3,826
2 votes
1 answer
71 views

I am trying to sort some REST API responses and extract data from them, and found this helpful answer on how to end up with a hashtable at the end. $res= (Invoke-RestMethod @commonParams -uri "...
Graham Reynolds's user avatar
2 votes
2 answers
140 views

I have a PSObject that I have filled with a json structure. I need to be able to set the value of one of the entries in the tree using an array that has the names nodes of the json path. Here is an ...
Vaccano's user avatar
  • 83.3k
7 votes
2 answers
3k views

I am trying to run this in PowerShell7 PS C:\Users\MYUSER> $myoutput = get-service| where-Object Status -eq "Stopped"| select-Object Name, Status However, I am getting the below error: ...
Javi Torre's user avatar
0 votes
0 answers
621 views

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 ...
FloorPills's user avatar
0 votes
1 answer
3k views

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 ...
user1063287's user avatar
0 votes
0 answers
330 views

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 ...
cfraser17's user avatar
1 vote
1 answer
618 views

I have a strange problem with Visual Studio code related to selecting the default Powershell version: I have installed Powershell 5.1 and 7 parallely, but when I doubleclick on a ps1-file, it should ...
Erik's user avatar
  • 2,466
0 votes
1 answer
182 views

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 ...
user602214076's user avatar
0 votes
1 answer
131 views

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 '...
Simon's user avatar
  • 1,593
0 votes
1 answer
798 views

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 "...
user avatar
0 votes
1 answer
547 views

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 ...
FloorPills's user avatar
2 votes
2 answers
4k views

I've been trying to run a PowerShell script, and upon doing so, I receive a message that NuGet Provider is required. NuGet provider is required to continue This version of PowerShellGet requires ...
Timothy G.'s user avatar
  • 9,859
0 votes
0 answers
71 views

I'm working on some PowerShell code that used to work and has broken. I noticed in PS5 when I run get-help against the below help section I receive: Get-Help : Get-Help could not find C:\PATH\program....
Grant Curell's user avatar
  • 1,873
1 vote
1 answer
7k views

I was trying to install Az-Module in my Ubuntu power-shell, But It wasn't installing than I double checked the PSRepository and I came to know that I don't have any repository there. I also have tried ...
Muhammad_Bilal's user avatar
0 votes
1 answer
1k views

We were using Azure DevOps Pipelines and PowerShell Remoting to execute PS1 scripts: trigger: none jobs: - job: PSRemoting timeoutInMinutes: 5760 pool: name: 'DevOps-Agent2-VM' ...
WinBoss's user avatar
  • 695

1
2 3 4 5