Category "powershell"

How to install git on Windows 10 without Git Bash or GUI?

I am trying to install Git on Windows 10, but without Git Bash or GUI. I want to use Git in PowerShell and I would like not to bloat my PC. I know the install s

Find and replace with PowerShell based on the next line

I'm trying to find and replace via PowerShell based on what's on the next line of the line I want to replace. For example, the following text file: blahblah

Set NewMessageSignature with Powershell without using Word

So far, the only way I've found to change the default New Message Signature in Outlook is by instantiating Word: $MSWord = New-Object -COMObject word.applicatio

How can I get the Log directory?

I have recently installed SSAS on my servers and instead of going through 24 of them, I am writing a script to get back the logDir of the servers. I am trying

How to print UTF-8 (or unicode) characters in Go (golang) on Windows

Let's have a look at this: ✓ Hello, 世界 As you can see there is a unicode checkmark and chinese/japanese characters. In go, If I use MSYS

What does this PowerShell syntax mean?

In powershell what does the syntax $x = . { ... } mean? How is it different from $x = @( ... ) From what I can tell they both create an array of the provided va

How can I optimize this Powershell script, converting JSON to CSV?

I have a very large JSON Lines File with 4.000.000 Rows, and I need to convert several events from every row. The resulted CSV File contains 15.000.000 rows. Ho

Add-PnPEventReceiver only works fully when -UseWebLogin parameter is used

I'm using PnP Powershell to add an Event Receiver to a document library. The Event Receiver points to an Azure function. Below is code that I wrote in a local

How to check if SQLAlwaysON is existing in server using powershell without a SQL DBA Admin access?

I want to check if SQLAlwaysON exists in server. I already know that typing and getting the powershell commands Enable-SQLServerAlwaysON and Disabled-SQLServerA

Can I use splatting to pass arguments to a non-powershell executable?

Can I do something like this? $splatting_table = @{ "-parameter" = "value" "-parameter2" = "value2" } .\external-command.exe @splatting_table as an equ

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