Category "powershell"

Apply a file to multiple folders using better PowerShell script

I'm working on a project where I have to apply a file to multiple folders every so often. I'm trying to learn some PowerShell commands to make this a little ea

Rails Console no scroll in windows powershell

I am curently setting up my rails enviroment on my Windows 10 pc. I am using powershell for this. I have found a bug when using a pry or the rails console. When

Pester test is failing when an expected error is thrown

I'm trying to use Pester for PowerShell to test some of my code, but I'm unable to get Pester to work in relation to errors. Take this very basic example - us

Colored text output in PowerShell console using ANSI / VT100 codes

I wrote a program which prints a string, which contains ANSI escape sequences to make the text colored. But it doesn't work as expected in the default Windows 1

need Invoke-WebRequest to finish before making another Invoke-WebRequest

I have some Powershell code where I make a request for a bearer token, then use the response to make another request to an API. What's happening is the request

Trying to group __InstanceCreationEvents from WMI Query -

I have a WMI query that notifies me on USB insertions, but I am trying to group the results of this query so that my handler can operate on a batch of these ins

Google API GMail oauth2 can't refresh a RefreshToken after a week

I've a system that sends an email every day using GMail API. I get the RefreshToken once then save it to a file. before send daily mail the RefreshToken is refr

Add Windows Credentials using PowerShell & cmdkey

I am trying to use credentials from some UI prompted to add Windows credentials using cmdkey: $sessionCredential = $host.ui.PromptForCredential("Need credential

PowerShell - Inserting newline char in string during regex replace

I'm trying to search a string for some numbers and insert a new line before each, not including the first one. I don't seem to be able to use the traditional r

"Firebase cannot be loading because running scripts is disabled on this system", VSCode on Windows

I have installed the firebase tools, however whenever I try to initialize it in my rootfolder, using the terminal from Vscode, I receive the following error. Wh

DataGridView with SuggestAppend comboBox columns and dynamic Cell assignment

I have been doing some research and could not find an answer for this, probably I'm not asking the right question or what I'm attempting might not be possible.

getting Missing opening '(' after keyword error in ffmpeg loop command

How can I run this command that runs in Linux in Windows 10 powershell for ffmpeg? for file in D:\input\*.mkv; do ffmpeg -i "$file" -map 0:v:0 -map 0:a:0 -map 0

How to sort strings in a file numerically

In my batch script there will be a temporary file with the notes that are in a section (gotten from a json file but that doesn't matter) Format: (position of no

How to get a list of files into a Powershell array

I want to get a list of files into a Powershell variable that I can use in subsequent code. Files: file1.csv file2.csv $sourceFiles = Get-ChildItem .\file*.c

Powershell Color Schemes?

Is there a place where I can find Powershell Color Schemes that people have already built? Something like https://github.com/lysyi3m/osx-terminal-themes, but fo

Capture output from powershell without The PowerShell object

In my c# app there is some button, when the user clicks on this button the app runs a powershell script. a window of powershell pops out and the user see the r

Azure DevOps: How to retrieve a build artifact from build Azure Pipeline from a PowerShell Script in Release Pipeline?

I have a published a build artifact published to $(Build.ArtifactStagingDirectory)/drop with artifactName "some_sidebar" and the artifact publish location is Az

Exporting a result list onto an HTML email alert

I am trying to export the result of a powershell script. The idea is to export the result via email on Azure. The code snippet can be found below. Get-AzSqlServ

Trapping a PowerShell Statement from Win32_Process into a Variable for Taskkill Command

This powershell statement looks for a long commandline string from a process java.exe - it uses the string server1 to trap this specific process. It returns th

A better way to slice an array (or a list) in powershell

How can i export mails adresses in CSV files in a range of 30 users for each one. I have already try this $users = Get-ADUser -Filter * -Properties Mail