Category "powershell"

Powershell replace values in target.json with values from source.json

I have a big target json file (parameters_general.json) where all common settings for a deployment are set. For each tier I have another json file (ex: paramete

New-localuser with joined string password

What is going wrong with this: $pass= "kissa"+"koira" $pw= ConvertTo-SecureString $pass -AsPlainText -Force #Create local user New-LocalUser -Name $username -P

Retrieving file information of specific date using powershell

I have a base folder as: D:\St\Retail\AMS\AMS\FTP-FromClient\AMS It contains various folders of dates: 2022-04-01 2022-04-02 ... ... 2022-02-02 2021-05-05 201

How can I combine these 2 functions to add a network profile using a 3rd parameter?

[After playing around with it for a few hours I did find a solution] I have 2 different functions I have written to add a network profile. The first is to add a

Powershell Formatting for a String

I have a string that I want to insert dynamically a variable. Ex; $tag = '{"number" = "5", "application" = "test","color" = "blue", "class" = "Java"}' I want t

PowerShell Get-Team Display Name from GroupID

Good afternoon all, Would greatly appreciate your help and perhaps a little of your patience as i am very very new to Powershell. I am trying to export a .csv l

sendkeys doesn't work inside github API (command line)

I'm trying to automate the creating of remote repos using powershell and gh repo create and the first thing that happens after running that command is an option

Get SCCM Collection Info from List of Servers

I need to get SCCM collection info form a list of 150 servers to figure out what deployment collections each device belongs to. I can easily list all devices fr

Pester for Connect-NetScaler

Hey guys having trouble writing pester for this function. The function is down below. Here is a link of the code if you prefer looking on here. https://www.powe

Azure App Configuration export and import

I have a pretty simple line on code for import/export App Configuration between different envs. az appconfig kv export -n appc1 -d file --path abc.json --format

Connect to Exchange Online PowerShell with EXO V2 Powershell Module under Linux - Connect-IPPSSession

Im trying to connect to the Online PowerShell with the EXO V2 Powershell module using the Connect-IPPSSession Cmdlet with certificates. Under Windows everything

Create a Powershell ListBox Sticky Notes Backup Utility

I'm building a PowerShell utility that will backup and restore sticky notes using a powershell script to pull the Get-localuser command from a local device into

Using backticks to escape characters in sed with PowerShell running on Windows

I'm aware that, in PowerShell, backticks(`) are used to escape characters instead of the backslash(\). Hence, when using sed, this: echo '"where am I"' | sed "s

Save changes in ms access file

$path = “C:\path\myfile.mdb” $cn = new-object -comobject ADODB.Connection $rs = new-object -comobject ADODB.Recordset Opening connection to the Dat

How can I force Powershell to return an array when a call only returns one object?

I'm using Powershell to set up IIS bindings on a web server, and having a problem with the following code: $serverIps = gwmi Win32_NetworkAdapterConfiguration

Renaming Multiple Printers "Rename-Printer"

Having trouble with trying to import a .csv or .txt with multiple printer names (shown below). Running this locally on a server to change printer names in a lis

Why I cannot authenticate an app in Azure

I am trying to authenticate app in azure, but getting the following error, Response status code does not indicate success: 401 (Unauthorized). Authentication

How do you make a foreach create multiple variables?

I'm trying to make a script that will check a bitlocker encryption percentage and set it as a variable but for each drive. For example. I run my script that wil

How to destroy resources created using terraform in azure devops pipeline by using PowerShell

I have a project where I'm using Terraform in Azure DevOps Pipeline create Infrastructure but want to destroy the infrastructure in a PowerShell script running

Run VS code projects through batch file

I have so many projects I have to open during windows startup. So I have created batch file to open them in vs code as following. start cmd /C code C:\project1