Category "powershell"

Clear out powershell terminal variables

Say I have the following powershell script: $hello = "Hello World" Write-Output $hello When I run it I get Hello World Then I decide that I want my variable

Trying to back up my Bitlocker Key to ADDS Through Script

I'm trying to automatize the process of storing BitLocker Keys to ADDS. I wanna be able to run the following script at logon, in order to do that, as the OS is

powershell regex replace using variable parameters when calling replace

I wondering how to make the following powershell code work with regular expressions. For example I want to call it like this: rename_file -OneFile proj1_file.t

How to execute Powershell's "start-process -Verb RunAs" from inside a Batch where the elevated command inherits the Batch's environment?

1. Problem I have a complicated batch file where some parts need to run with elevated/admin rights (e.g. interacting with Windows services) and I found a Powers

How can I connect to my REST API with powershell (CYPHERTRUST)

I am searching for how to connect to my rest API with a Powershell script I know that I need a to send my Body with the POST Method but cant define how to do it

EWS Powershell Script to manipulate messages in junk email

I'm trying to write a simple Script, in PowerShell using EWS managed API. The premise is I need to establish connection with our Enterprise Office365 Exchange e

Powershell Progressbar partially hidden

I have a progress bar that is run when a job is done. Unfortunately, the progress bar is partially hidden. This is the code: Add-Type -AssemblyName System.Windo

Microsoft-Graph: Invoke-MgGraphRequest returns unable to cast object of type JsonObject to JsonArray

I am trying to use Invoke-MgGraphRequest to convert immutableEntryIds to ewsIDs. I have been following Microsoft's documentation and have created the following

Functions do not get loaded into Workflow

When I use a Workflow, only the functions directly called in the Workflow get loaded from the calling script. When dot-sourcing the following script and call Ma

Prevent variable and special character substitution in variable

I'm loading a regex from a file into a database using a stored procedure, like this: $stuff = Get-Content -Path '.\data.txt' -Raw Invoke-Sqlcmd -Query "Exec dbo

How to save color of string into variables

I'm using PowerShell 5.1, and I want to store some colored text into a variable. I'm aware that you can use Write-Host to print out some colored strings into th

Add PowerShell package as native dependency

How should one add the PowerShell package as a Native dependency? In spite of adding it one is unable to run basic PowerShell commands to show output on the scr

Parse column values line by line and pass to ifelse

I have code in shell script, but can't figure out how to parse line by line in column. If person is absent I want to send email. if person is late than hour the

Powershell Unprotect Fails With Unknown Error "-805306355"

I'm creating a NetSec project to read Chrome information, but the Powershell Unprotect Function returns an unknown error code while trying to read the AES encry

Az Powershell Connect-AzAccount fails in docker container, but works on host

Problem I have a Windows 10 machine with Powershell 7. I wrote the following logic to sign into azure using a service principle: $Secure2 = ConvertTo-SecureStr

Azure Pipelines: Start-Process with credentials not working

I am trying to start an application from Azure Pipelines YAML using Powershell. I want the app to start with a non-administrator account, while the Azure Pipeli

Merge two html file output that contains tables also in single html file (in comparison table format)

I have two html files containing vm information like os details, memory, network details etc. in table format for pre and post migration. For final analysis I n

Version strings to "System.Version" too long (or short) in PowerShell

How can I force conversion to type System.Version in PowerShell, or more likely, better understand why I cannot arbitrarily assign number strings type System.Ve

Adding Leading Zeros in .csv file

I am trying to create a PowerShell script that adds two leading zeros to all the numbers in a particular column.This script is able to add the two zeros to the

How to remove specific service plan from O365 license using powershell

I have the following script to apply a DESKLESS license Connect-MsolService Import-Csv 'C:\users.CSV' | foreach {Set-MsolUser -UserPrincipalName $_.EmailAdress