Microsoft Q&A
PowerShell
363 questions
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
Content
Az PowerShell Function - HTTP 204 No Content
Hi All, I need some insight on how to troubleshoot this scenario. I am trying to access the VM using the Az PowerShell Function hosted on the same vnet and this is just a test only. my objective is to access the Windows AD after successfully connecting…


How to Unallocate the free space in the virtual Disk created from the storage pool
Say Our Initial Disk Size is 128GB. Assume Disk is Empty now we have taken up a Storage pool of 256GB and Created VirtualDisk. Start Mirroring. say after 30 Minutes Mirroring is Done from Initial Disk to VirtualDisk. Now, Remove the Initial…


SharePoint Online - PnP PowerShell - Remove Installed Apps
Hi MS Q&A, Have been attempting to report on available Apps deployed / installed against a SharePoint Online Site Collections via the following PowerShell operations to help with subsequent removal / uninstall: $web = Get-PnPWeb –Includes…


About PowerShell Scriptblock non work problem
Hi All, I created PowerShell went to auto download adobe reader and auto install, but always show exitcode:87 My Script: #################################### # Catch Local File Cunnect Version # #################################### $Path =…


Azure Automation - Source Control - PAT - Powershell
I have created an azure automation account and wish to setup a source control connection with github using a PAT. The PAT has been created with the correct permissions but when I try to run the powershell command I get the following…
Scheduled Task permission issues
Hello Everyone I am having an issue with an ongoing Scheduled task for a Powershell Script. I am only able to run the task when I User who belongs to the Domain Administrator Group, but I cannot let it run with the SYSTEM-User or a User with local…


Need some help with using user email address to pull distinguished name.
I have a script which compares existing user attributes with an ADP file and updates them per the file. The script is working well, but it's not able to get the manager distinguished name so it can be changed. Below is the function I'm using, but I don't…


High CPU usage for vmmem
Hi, I have experienced high CPU usage for Vmmem frequently (~every 2days) and the only solution at the moment is simply restart my machine. It is understood that is related to WSL and I do have a Docker image running on Ubuntu on Windows. However it is…
Trying to change brightness on my desktop screens via powershell and encountered an error
Hello, I want to change the brightness of my screens (I have two screens) on my desktop computer using PowerShell. I use this command: (Get-WmiObject -namespace root/wmi -class WmiMonitorBrightnessMethods).wmisetvrightness(1,20) and I get an error…


Add-Type error MailKit
I am trying to write a Powershell script that runs MailKit.3.6.0 starting with the command: Add-Type -Path "C:\Program Files\PackageManagement\NuGet\Packages\MailKit.3.6.0\lib\netstandard2.0\MailKit.dll" and get the error Add-Type : Unable to…


Get-AzRoleAssignment -SignInName "XXX" is not filtering the RoleAssignments of the Resource Level via PowerShell
Hi Guys, Currently i am working on by automate the Azure Role Assignments using PowerShell script. When i use Get-AzRoleAssignment -SignInName "XXX"- i can get the details for some of the users. However, the same command won't return any data…


Delete users in a OU after days
I adapted the script below to my needs. I can't get the remove users part to work $Days = 1280 $LastModified = (Get-Date).Adddays(-($Days)) $Users =Get-ADUser -filter {Enabled -eq $False} -SearchBase 'OU=DisabledAccount,DC=adr,DC=it' -properties…


Methodology to Mimic Dynamic Disk Mirroring action for existing volume using StorageSpaces
We are able to mirror the existing data present in a disk with the say Volume F: using the disk management tool /disk part commands. But i would like to replicate this mirroring of Existing Volume using storagespaces. Please do guide me with relevant…


Current security context error on Microsoft.SqlServer.Management.SMO.Transfer while transfer data to Azure SQL
Lets say that my code looks like this: [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.Smo") | Out-Null #Source server is a standars MSSQL server $sourceServer = New-Object…


How to Initialize attached Data disk to Linux VM in Azure with Powershell
The Initialize the disk doc explains how to initialize an attached disk for Windows VM. I need to do the same for Linux VM with Powershell. Any resource available ?


SharePoint Online - PnP PowerShell - Get Installed Apps
Hi MS Q&A, Seeking advice and recommendation on PnP PowerShell cmdlets that can assist with listing the available Apps deployed / installed against a SharePoint Online Site Collection. Had been attempting with Get-PnPApp, however it does not appear…


Remove Home Teams (Chat) app but keep Enterprise Version on AutoPilot systems
Hi All - We are starting our Windows 11 testing for AutoPilot systems from Intune. We want to get rid of the home version of teams (AKA Chat). However we want to keep the corporate/enterprise version of teams. How can we do this and get rid of the app…


Powershell XPATH seems to be not working
I am using Wifi profile xml files as an example. In the below code if i use xpath as $XPath = "//*" I get the list of all nodes in the xml. But if I specify specific node and all nodes under it with $XPath = "//WLANProfile//*", I get…
PowerShell: how to know if email message has never been read
I'm struggling to try to know if an email message has ever been read... I have to use PowerShell Someone can give me some help? thanks!


How to get information on Service Health Incidents with attached PIR (PDF)
Is it possible to get a list (PowerShell or Azure Support REST API) of Service Health Incidents that have a Post-incident report PIR (PDF) attached?

