Category "powershell"

Azure PowerShell Connect-AzureAD and Connect-MsolService both with MFA connect

i use a script to connect AzureAD and MsolService. Connect-AzureAD Connect-MsolService and it ask me both for username, password, and telephone verification. I

In Powershell, how to wait for parallel jobs to finish before proceeding?

Based on How to execute a PowerShell function several times in parallel?, I'm able to do this, where I stop all running jobs, in parallel. # Run this in paralle

Can't use GitHttpClient from Powershell, Newtonsoft.Json version conflict

I'm trying to consume Azure DevOps .NET API, specifically the Git client, from Powershell 5.1. There is a copy of all client libraries under C:\Program Files\Mi

Creating azure ad group with group types "Unified" and "DynamicMembership" fails in azure powershell function

I am using AzureAdPreview moudule and with the help of this I am trying to create a group with types "Unified" as well as "DynamicMembership". So as per microso

powershell return value $? and custom exit code [closed]

I installed powershell on Linux-Box. At end of my *.PS1 file I put the following code: Exit 2222 I run my ps1 file such as: pwsh-lts -File my

Add specific printer to multiple servers

I am new to powershell and would like to create a tool to add a single printer to multiple servers. Here is my code so far: $printer = read-host "Please enter t

Delete folder content for a folder for remote machine using powershell

I am having the below code to delete the contents for folder $SB_Folder = "\\$hostname\c$\SB" $Automation_Folder = "\\$hostname\C$\Scripts\" Get-ChildItem -Pat

Powershell adjust the format table width

This is the script get-childitem D:\media\*.mkv -recurse | Select-Object -Property name, @{n='Resolution';expression={mediainfo $_.FullName --inform="Video;%Wi

Powershell Script to create Scheduled Task on non domain computers

We are trying to execute a powershell script that will import a scheduled task to non domain and domain joined computers in our organization. The task is simpl

PowerShell - Import-CSV - How can I keep leading zeros on all decimal numbers being imported

I am trying to perform changes to a existing CSV, such as keeping specific columns (and removing the rest). However when I use Import-CSV, the leading zeros on

Powershell AD module not installed but RSAT feature is installed

Objective Local User Password change without admin rights -> Powershell AD Methods Logging on a distant PC using Remote Desktop Connection (RDP), on this PC

In powershell spawn notepad++ when file to open has spaces in it

$npp = "C:\Program Files\Notepad++\notepad++.exe"; $myfiles = @( "C:\bad boys\file1.txt", "C:\bad boys\file2.txt", "C:\bad boys\file3.txt" ) fore

Login Powershell Script filter to only run script if computer is in a specific OU

Using Powershell need helping with filtering If the current computer is within any of the sub OU under OU=Workstations,DC=blah,DC=com then script should continu

How to pass a parameter to commandToExecute in Azure Custom Script Extension

I have a Azure Vm extension in which i want to run a PowerShell script which takes a parameter -Install: PS C:\Users\abc\Downloads\InstallPackage-2022\InstallPa

Looking to create a script to decrypt password protected PDF files

I have multiple directories of password protected PDF files and I'm looking to decrypt all of these files and save the resulting decrypted file as a new file in

How do I upload the last 3 files in a directory with WinSCP?

Trying to upload the last 3 files in a directory. I figured I can set the last 3 files and make them as an alias but I'm not sure how to do that.. Originally Wi

Extending Bulk AD Accounts Expiration date by 6 months via PowerShell

I am fairly new to PowerShell and this maybe straight forward for a professional. I am looking to extend expiration date a bulk of AD usernames in a text file b

Error when installing necessary packages on Node js

I was installing Node.js on Windows. It installed successfully, and I also selected the option to install necessary files (such as chocolatey) in the node.js in

Terraform virtual machine extension doesn't run as expected

maybe someone can help me with my situation. Scenerio: I created a terraform script which create a windows 10 Virtual machine in Azure. At the end the terraform

How to accept Youtube Cookies Consent with Powershell

Since few days I'm not able to consume any information from Youtube with my Powershell Script, at first the cookies must be accepted in order to see the Videos.