119,103 questions
Score of 0
0 answers
14 views
Node.js not installing onto Windows system in Hermes Agent setup [closed]
I was told about Hermes Agent being a popular agent, and I downloaded an installer which was unable to complete because Node.js could not be installed. So, I scrapped the setup then.
I must have then ...
Score of 0
1 answer
118 views
Git clone over SSH hangs in WSL2 at expecting SSH2_MSG_KEX_ECDH_REPLY
I’m trying to clone a private GitHub repository over SSH from inside WSL2 (Ubuntu):
git clone [email protected]:username/repository.git
The command starts normally:
Cloning into 'repository'...
but ...
Score of 5
3 answers
143 views
Detect whether PowerShell scripts can be executed from Windows Batch
I have a Visual Studio project with a post-build event. Part of the post-build script executes a PowerShell script. I recently moved to a new computer, and the PS script failed with this error:
The ...
Score of 2
2 answers
129 views
PowerShell inconsistency?
ls * | ft length
ls * | ft {$_.length}
In the first statement the length of the subfolders in the current folder shows up as $null and in the second as 1. Can somebody please explain to me what the ...
Score of -1
2 answers
320 views
What is the equivalent Cmd.exe program for this PowerShell one-liner program?
I have a program (program.exe) that converts XML files to HTML files. I use the following PowerShell command to convert all XML files in a specified directory to HTML files:
Get-ChildItem -Path E:\...
Score of 2
1 answer
136 views
Confusion about pipe ("|") character in an environment variable in different Windows CLI tools
I'm trying to declare an environment variable in Windows that can be used by any of the three CLI's that I use: CMD, Powershell, and git-bash. But I'm getting confusing behavior with the way the | is ...
Score of 6
1 answer
166 views
How can I connect to MgGraphs and Exchange Online in the same PowerShell session?
I have seen the suggestion to not access Exchange online as Admin but I will not be able to make the necessary changes to user mailboxes without logging into Exchange as admin. I've tried connecting ...
Score of 2
1 answer
84 views
Using PS, export users in the AD groups that have certain prefix and suffix
How would I export all of the users in the AD groups that start with prtr and end with -d using PowerShell?
Example:
prtr-fin1-d
prtr-int1-d
prtr-med1-d
I want to exclude groups that start with ...
Score of 0
0 answers
62 views
Unexpected behavior with ADSI PutEx method and dynamic parameters
I have rearranged an ADSI script that used dynamic parameters because these ones were not correctly bound (the script has 7 mandatory parameters and 19 not mandatory - if you are wondering why so much,...
Score of 2
1 answer
173 views
PowerShell .ForEach() method
I tried to reproduce an example from the MS page: about_arrays
The five lines of code are:
$myObject = [pscustomobject]@{
singleValue = 'Hello'
arrayValue = @(0..10)
}
$myObject.ForEach('...
Score of -2
1 answer
103 views
How to use lookup join instead of enrich policy in elasticsearch using powershell?
I am trying to automate using lookup join instead of enrich policy in Elasticsearch using PowerShell, but I'm not sure how to do that.
The existing code using enrich policy is working fine:
$...
Score of 0
2 answers
136 views
Case insensitive HashSet[Object]
Unlike a case insensitive type-safe (string) HashSet (see also this answer):
using namespace System.Collections.Generic
$hashset = [HashSet[String]]::new([StringComparer]::InvariantCultureIgnoreCase)
...
Score of 2
2 answers
194 views
Why does `QueryServiceConfig2` return a "The parameter is incorrect" error when requesting a service's preferred node?
I'm writing C#/PowerShell code to get all a service's configuration with QueryServiceConfig2 using P/Invoke. I'm able to get all configuration information except preferred node (...
Score of 3
0 answers
134 views
Use [ADSI] in PowerShell to make changes on AD objects with Server 2025 fails for some operations (ACL commit)
I have some scripts in Active Directory environments that use [ADSI] or [ADSISearcher], and for some I can't use the *et-AD* commandlets in PowerShell. PowerShell 5 is a requirement.
A few of them are ...
Score of 1
0 answers
161 views
Typed [Ref] argument in a PowerShell class method [duplicate]
I'm trying to translate this C# class to PowerShell:
$source = @'
using System.Dynamic;
using System.Collections.Generic;
public class xDynamicObject : DynamicObject
{
readonly Dictionary<...