# PowerShell Help

**URL:** https://forums.powershell.org/c/powershell-qa/5.md

[Latest](https://forums.powershell.org/latest.md) · [Categories](https://forums.powershell.org/categories.md)

---

## [Guide to Posting Code - Redux](https://forums.powershell.org/t/guide-to-posting-code-redux/15797)

<div class="topic-metadata">

**Author:** [@grokkit](https://forums.powershell.org/u/grokkit)\
**Replies:** 0\
**Last updated:** [March 1, 2021, 10:48pm UTC](https://forums.powershell.org/t/guide-to-posting-code-redux/15797 "2021-03-01T22:48:56Z")

</div>

Discourse uses Markdown for text formatting. There is a reference sheet and quick tutorial here: Markdown Reference You can produce in-line code formatting by wrapping your code in backticks (\`). For example, \`Get-Child…

---

## [About the PowerShell Help category](https://forums.powershell.org/t/about-the-powershell-help-category/10)

<div class="topic-metadata">

**Author:** [@system](https://forums.powershell.org/u/system)\
**Replies:** 0\
**Last updated:** [February 19, 2021, 10:58am UTC](https://forums.powershell.org/t/about-the-powershell-help-category/10 "2021-02-19T10:58:28Z")

</div>

Welcome to the PowerShell Help forums where experts and community contributors helps each other to learn and share knowledge. More info about the old forums and guidelines :point\_right: Welcome to the new PowerShell For…

---

## [Search from text in string and write index](https://forums.powershell.org/t/search-from-text-in-string-and-write-index/26544)

<div class="topic-metadata">

**Author:** [@Darkveemon1](https://forums.powershell.org/u/Darkveemon1)\
**Replies:** 3\
**Last updated:** [August 31, 2026, 2:25pm UTC](https://forums.powershell.org/t/search-from-text-in-string-and-write-index/26544 "2026-08-31T14:25:59Z")

</div>

Hi, I have a bit of an issue with a script. Basically I have a text of variable length inside a variable, I have to extract some specific parts when a specific string is present. Here is an example of my text çCodeç:1…

---

## [Invoke-RestMethod : The request was aborted: Could not create SSL/TLS secure channel](https://forums.powershell.org/t/invoke-restmethod-the-request-was-aborted-could-not-create-ssl-tls-secure-channel/26540)

<div class="topic-metadata">

**Author:** [@Darkveemon1](https://forums.powershell.org/u/Darkveemon1)\
**Replies:** 2\
**Last updated:** [August 18, 2026, 9:42am UTC](https://forums.powershell.org/t/invoke-restmethod-the-request-was-aborted-could-not-create-ssl-tls-secure-channel/26540 "2026-08-18T09:42:31Z")

</div>

Hi, I have a simple script that runs a Post API $MyUrl = "https://..." Invoke-RestMethod -Uri MyUrl -Method POST But i get the error in the title. I tried it on 3 different PC’s, with Windows 7, Windows 10 and Windows …

---

## [Why on earth are ActiveDirectory permission errors terminating?](https://forums.powershell.org/t/why-on-earth-are-activedirectory-permission-errors-terminating/26500)

<div class="topic-metadata">

**Author:** [@pcarr](https://forums.powershell.org/u/pcarr)\
**Replies:** 0\
**Last updated:** [July 9, 2026, 3:24pm UTC](https://forums.powershell.org/t/why-on-earth-are-activedirectory-permission-errors-terminating/26500 "2026-07-09T15:24:34Z")

</div>

I’m writing a script that batch modifies and deletes computers using Move-ADObject, Set-ADComputer, and Remove-ADComputer. I would prefer to use pipelines with the -ErrorVariable parameter, because it’s a bit cleaner and…

---

## [Import-CSV, wrong file](https://forums.powershell.org/t/import-csv-wrong-file/26497)

<div class="topic-metadata">

**Author:** [@Darkveemon1](https://forums.powershell.org/u/Darkveemon1)\
**Replies:** 1\
**Last updated:** [June 12, 2026, 12:53pm UTC](https://forums.powershell.org/t/import-csv-wrong-file/26497 "2026-06-12T12:53:14Z")

</div>

Hi, I’m having a problem I cannot explain and I hope you can help me. I have 2 CSV files with sales of every month of the year, they are structured like so: 6 columns with fixed values and 365 columns, one for every day.…

---

## [Generate SharePoint Owners, Members, and Visitors Report](https://forums.powershell.org/t/generate-sharepoint-owners-members-and-visitors-report/26479)

<div class="topic-metadata">

**Author:** [@vs45](https://forums.powershell.org/u/vs45)\
**Replies:** 1\
**Last updated:** [June 9, 2026, 4:22pm UTC](https://forums.powershell.org/t/generate-sharepoint-owners-members-and-visitors-report/26479 "2026-06-09T16:22:21Z")

</div>

Hello everyone, I want to generate a list of all SharePoint sites in the tenant, showing the owners and members for each site, and, if possible, the visitors as well. I have been experimenting with the following module…

---

## [Print test page on default printer](https://forums.powershell.org/t/print-test-page-on-default-printer/26397)

<div class="topic-metadata">

**Author:** [@kkoop](https://forums.powershell.org/u/kkoop)\
**Replies:** 6\
**Last updated:** [May 20, 2026, 7:08pm UTC](https://forums.powershell.org/t/print-test-page-on-default-printer/26397 "2026-05-20T19:08:22Z")

</div>

I thought this would be simple, but apparently not. I would like to send a test page to the default printer on the workstation I’m logged into. It should be the same test page I would get if I opened Printers and Scan…

---

## [Function in Expression field](https://forums.powershell.org/t/function-in-expression-field/26391)

<div class="topic-metadata">

**Author:** [@RobR](https://forums.powershell.org/u/RobR)\
**Replies:** 1\
**Last updated:** [May 15, 2026, 10:50am UTC](https://forums.powershell.org/t/function-in-expression-field/26391 "2026-05-15T10:50:54Z")

</div>

Hello Community, i would like to calculate a value ProcTimeTotalMinutes inside an expression field with a function. The function will be triggered, but the result will not be displayed. Where is the problem? Thanks F…

---

## [Getting Accurate Membership counts for AD Groups?](https://forums.powershell.org/t/getting-accurate-membership-counts-for-ad-groups/26367)

<div class="topic-metadata">

**Author:** [@Scott\_Post](https://forums.powershell.org/u/Scott_Post)\
**Replies:** 5\
**Last updated:** [April 23, 2026, 2:14pm UTC](https://forums.powershell.org/t/getting-accurate-membership-counts-for-ad-groups/26367 "2026-04-23T14:14:19Z")

</div>

I have tried the following: (Get-ADGroupMember \<group\_dn\> -server \<domain or specific DC\>).Count Get-ADGroupMember \<group\_dn\> -server \<domain or specific DC\> | Measure-Object (Get-ADGroup \<group\_dn\> -server \<domain or…

---

## [Comma as a Unary Operator](https://forums.powershell.org/t/comma-as-a-unary-operator/26357)

<div class="topic-metadata">

**Author:** [@NinjaPirate](https://forums.powershell.org/u/NinjaPirate)\
**Replies:** 3\
**Last updated:** [April 22, 2026, 10:04pm UTC](https://forums.powershell.org/t/comma-as-a-unary-operator/26357 "2026-04-22T22:04:40Z")

</div>

I’m reading through Powershell in Action and this one spot in Chapter 5 makes my head hurt. I comprehend what’s happening here but I’d like some help on its usefulness and why it’s doing it. $a = 1,(2,3) $b = $a | forea…

---

## [Scripting project for SharePoint sites' cleaning](https://forums.powershell.org/t/scripting-project-for-sharepoint-sites-cleaning/26366)

<div class="topic-metadata">

**Author:** [@amaretto](https://forums.powershell.org/u/amaretto)\
**Replies:** 0\
**Last updated:** [April 15, 2026, 12:53pm UTC](https://forums.powershell.org/t/scripting-project-for-sharepoint-sites-cleaning/26366 "2026-04-15T12:53:33Z")

</div>

Hello! I’m an intern and just got the mission of cleaning useless sites from SharePoint by hand. A lot of it is repetitive and I’m pretty sure there is a way of automatising it. This project concerns \< 2Go sites. My to…

---

## [Get Computer Name From AD Using Variable](https://forums.powershell.org/t/get-computer-name-from-ad-using-variable/26354)

<div class="topic-metadata">

**Author:** [@MTThomas](https://forums.powershell.org/u/MTThomas)\
**Replies:** 9\
**Last updated:** [April 4, 2026, 2:02am UTC](https://forums.powershell.org/t/get-computer-name-from-ad-using-variable/26354 "2026-04-04T02:02:50Z")

</div>

Hi! This is my first time posting here so hopefully I’m not committing any faux pas. I’m trying to pull a computer name from AD based on a partial name. All of our computers are named ending with an asset tag number. …

---

## [Explanating of code, $($\_.FullName) from Get-ChildItem and ForEach-Object](https://forums.powershell.org/t/explanating-of-code-fullname-from-get-childitem-and-foreach-object/26343)

<div class="topic-metadata">

**Author:** [@user1010](https://forums.powershell.org/u/user1010)\
**Replies:** 10\
**Last updated:** [March 17, 2026, 2:05pm UTC](https://forums.powershell.org/t/explanating-of-code-fullname-from-get-childitem-and-foreach-object/26343 "2026-03-17T14:05:45Z")

</div>

Get-ChildItem -Path "C:\\" -Filter \*.log -Recurse | ForEach-Object { "$($\_.FullName) is $($\_.Length) bytes" } Question regarding “$($\_.FullName)” - what does it do in detail? If I only use $\_.FullName it…

---

## [Scoping - How to get side effects in the calling scope?](https://forums.powershell.org/t/scoping-how-to-get-side-effects-in-the-calling-scope/26342)

<div class="topic-metadata">

**Author:** [@WorkDamnit](https://forums.powershell.org/u/WorkDamnit)\
**Replies:** 2\
**Last updated:** [March 6, 2026, 1:58am UTC](https://forums.powershell.org/t/scoping-how-to-get-side-effects-in-the-calling-scope/26342 "2026-03-06T01:58:23Z")

</div>

Hi, I have a script (script.ps1), in which a function is defined (func1). The script and function work fine, my problem is scoping. ‘func1’ needs to run in the current session. I can achieve that by dot sourcing script…

---

## [Need to swap print servers](https://forums.powershell.org/t/need-to-swap-print-servers/26341)

<div class="topic-metadata">

**Author:** [@kkoop](https://forums.powershell.org/u/kkoop)\
**Replies:** 6\
**Last updated:** [March 5, 2026, 7:02pm UTC](https://forums.powershell.org/t/need-to-swap-print-servers/26341 "2026-03-05T19:02:33Z")

</div>

I have two print servers - PS2 which is replacing PS1 Print queue names are the same on both print servers. There are about 25 users that are printing to the queue on PS1 and I would like to script a two-step Print Se…

---

## [Gather Remote Active NIC info with Domain Creds](https://forums.powershell.org/t/gather-remote-active-nic-info-with-domain-creds/26339)

<div class="topic-metadata">

**Author:** [@jperrygodfrey](https://forums.powershell.org/u/jperrygodfrey)\
**Replies:** 6\
**Last updated:** [March 4, 2026, 3:19am UTC](https://forums.powershell.org/t/gather-remote-active-nic-info-with-domain-creds/26339 "2026-03-04T03:19:49Z")

</div>

I am gathering info from separate AD Domains and updating a DB on the front-end side and I have having issues with adding a single quote for the active NIC. The -filter and the -InterfaceAlias needs a single quote and I…

---

## [PS GUI integrate scrollbar](https://forums.powershell.org/t/ps-gui-integrate-scrollbar/26338)

<div class="topic-metadata">

**Author:** [@bolle](https://forums.powershell.org/u/bolle)\
**Replies:** 1\
**Last updated:** [March 3, 2026, 12:03pm UTC](https://forums.powershell.org/t/ps-gui-integrate-scrollbar/26338 "2026-03-03T12:03:01Z")

</div>

Hi everyone, i use this PS GUI for my work. It’s a few years old and no longer updated. As soon as the resolution drops below FullHD, the bottom half of the GUI disappears. I had the idea of ​​adding a scrollbar to fi…

---

## [Learn PowerShell](https://forums.powershell.org/t/learn-powershell/26337)

<div class="topic-metadata">

**Author:** [@akj80](https://forums.powershell.org/u/akj80)\
**Replies:** 2\
**Last updated:** [February 26, 2026, 4:39pm UTC](https://forums.powershell.org/t/learn-powershell/26337 "2026-02-26T16:39:30Z")

</div>

Hi All, Thank you very much for your confirmation. I am currently trying to learn PowerShell, but I often feel overwhelmed by the number of commands I need to remember. I have started learning several times; however, aft…

---

## [Need some scoping help](https://forums.powershell.org/t/need-some-scoping-help/26336)

<div class="topic-metadata">

**Author:** [@tonyd](https://forums.powershell.org/u/tonyd)\
**Replies:** 3\
**Last updated:** [February 25, 2026, 3:17pm UTC](https://forums.powershell.org/t/need-some-scoping-help/26336 "2026-02-25T15:17:59Z")

</div>

Here is my scenario. I have a main script we will call “Main.PS1” This script loads a module we will call “Functions.PSM1” Main.PS1 calls a function in Functions.PSM1 called “function get-stuff()” The Get-Stuff funct…

---

## [Evaluate a script and give feedback](https://forums.powershell.org/t/evaluate-a-script-and-give-feedback/26335)

<div class="topic-metadata">

**Author:** [@jimgwhit](https://forums.powershell.org/u/jimgwhit)\
**Replies:** 1\
**Last updated:** [February 24, 2026, 5:09am UTC](https://forums.powershell.org/t/evaluate-a-script-and-give-feedback/26335 "2026-02-24T05:09:42Z")

</div>

Here the first script seems to work exactly like the second script. But when restoring the drive with Acronis I get the message a reboot is required to complete the operation. However the second script has no such messa…

---

## [Help explaining PSCustomObject](https://forums.powershell.org/t/help-explaining-pscustomobject/26334)

<div class="topic-metadata">

**Author:** [@user1010](https://forums.powershell.org/u/user1010)\
**Replies:** 6\
**Last updated:** [February 23, 2026, 4:15pm UTC](https://forums.powershell.org/t/help-explaining-pscustomobject/26334 "2026-02-23T16:15:17Z")

</div>

Got help from Copilot with making a script for getting serial number for the monitor. Anyone can explain what the \[PSCustomObject\] part does in the script? Get-CimInstance -Namespace root\\wmi -ClassName WmiMonitorID | …

---

## [Any one else having problems with Make2023BootableMedia.ps1](https://forums.powershell.org/t/any-one-else-having-problems-with-make2023bootablemedia-ps1/26333)

<div class="topic-metadata">

**Author:** [@jimgwhit](https://forums.powershell.org/u/jimgwhit)\
**Replies:** 0\
**Last updated:** [February 22, 2026, 7:04am UTC](https://forums.powershell.org/t/any-one-else-having-problems-with-make2023bootablemedia-ps1/26333 "2026-02-22T07:04:49Z")

</div>

I already created an issue here: \[Bug\]: Make2023BootableMedia.ps1 has errors · Issue #346 · microsoft/secureboot\_objects · GitHub In summary: I even updated the latest ADK with the patches and a June 2024 cumulative w…

---

## [Using Set-SPSite to lock specific sites in an Array](https://forums.powershell.org/t/using-set-spsite-to-lock-specific-sites-in-an-array/26316)

<div class="topic-metadata">

**Author:** [@LadySaidy](https://forums.powershell.org/u/LadySaidy)\
**Replies:** 1\
**Last updated:** [February 17, 2026, 2:08pm UTC](https://forums.powershell.org/t/using-set-spsite-to-lock-specific-sites-in-an-array/26316 "2026-02-17T14:08:24Z")

</div>

I have a list of a couple of thousand sites within our collection that are orphaned or have been inactive for a year or better. Some of them have Owners listed and some do not. Reading through a few other forums and pos…

---

## [Column of CSV, name vs constructed name](https://forums.powershell.org/t/column-of-csv-name-vs-constructed-name/26319)

<div class="topic-metadata">

**Author:** [@Darkveemon1](https://forums.powershell.org/u/Darkveemon1)\
**Replies:** 4\
**Last updated:** [February 5, 2026, 8:18pm UTC](https://forums.powershell.org/t/column-of-csv-name-vs-constructed-name/26319 "2026-02-05T20:18:12Z")

</div>

Hi, my problem is a bit strange and I don’t understand why. Basically I have a CSV with every day of the year as column and some numeric values inside, I’d like to select specific values using a for loop. In my array h…

---

## [Remove permissions for multiple offboarded users across the entire SharePoint and Microsoft 365 tenant using PowerShell](https://forums.powershell.org/t/remove-permissions-for-multiple-offboarded-users-across-the-entire-sharepoint-and-microsoft-365-tenant-using-powershell/26308)

<div class="topic-metadata">

**Author:** [@Crafter](https://forums.powershell.org/u/Crafter)\
**Replies:** 4\
**Last updated:** [February 2, 2026, 12:37pm UTC](https://forums.powershell.org/t/remove-permissions-for-multiple-offboarded-users-across-the-entire-sharepoint-and-microsoft-365-tenant-using-powershell/26308 "2026-02-02T12:37:25Z")

</div>

My tenant contains around 500 SharePoint sites and many internal and external users. When users are offboarded, their email addresses are stored in a CSV file. I want to create a PowerShell script that reads this CSV an…

---

## [Does my computer use LAN or WLAN](https://forums.powershell.org/t/does-my-computer-use-lan-or-wlan/26304)

<div class="topic-metadata">

**Author:** [@SG08234](https://forums.powershell.org/u/SG08234)\
**Replies:** 6\
**Last updated:** [January 13, 2026, 1:32am UTC](https://forums.powershell.org/t/does-my-computer-use-lan-or-wlan/26304 "2026-01-13T01:32:23Z")

</div>

I need a script which gives me the information: Does my computer use LAN or WLAN? Unfortunately “Get-NetAdapter” shows both connections with Status “Up”. How can I extract the currently used connection? Thanks - Michae…

---

## [Disk Performance - Winsat](https://forums.powershell.org/t/disk-performance-winsat/26303)

<div class="topic-metadata">

**Author:** [@SG08234](https://forums.powershell.org/u/SG08234)\
**Replies:** 11\
**Last updated:** [January 10, 2026, 3:40am UTC](https://forums.powershell.org/t/disk-performance-winsat/26303 "2026-01-10T03:40:21Z")

</div>

On all the computers I support I want/need to monitor the performance of all physical disks regurlarly via a Powershell script started via Windows scheduler: $out = winsat disk -seq -read -drive $laufwerk.deviceid fai…

---

## [Add ExtendedAttribute to Exchange Online mobile devices](https://forums.powershell.org/t/add-extendedattribute-to-exchange-online-mobile-devices/26294)

<div class="topic-metadata">

**Author:** [@ltwally](https://forums.powershell.org/u/ltwally)\
**Replies:** 2\
**Last updated:** [January 9, 2026, 4:49pm UTC](https://forums.powershell.org/t/add-extendedattribute-to-exchange-online-mobile-devices/26294 "2026-01-09T16:49:56Z")

</div>

I need to bypass Conditional Access for some mobile devices. The list would be too long to filter by the ExO device ID’s. However, if I can set an Extended Attribute to these devices, that would do the trick. Exchange…

---

## [How to list processes that lock drive](https://forums.powershell.org/t/how-to-list-processes-that-lock-drive/26298)

<div class="topic-metadata">

**Author:** [@feklee](https://forums.powershell.org/u/feklee)\
**Replies:** 2\
**Last updated:** [January 6, 2026, 2:55am UTC](https://forums.powershell.org/t/how-to-list-processes-that-lock-drive/26298 "2026-01-06T02:55:12Z")

</div>

For testing, I have a USB flash drive mounted on E:. I opened E:\\foo.png using IrfanView. That prevents the drive from being ejected. The 3rd party tool USB Safely Remove correctly identifies IrfanView as the blocking pr…

[Next page](https://forums.powershell.org/c/powershell-qa/5.md?page=1)
