119,236 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
0
votes
1
answer
57
views
Powershell issue getting count for all computers in sub OUs
I'm working on a script that will get all computer objects under an OU and all sub OUs to include Last logon date, Operating system, enabled true or false and then split the distinguished name then ...
1
vote
2
answers
83
views
Dealing with colons in paths stored inside a text file
I have a list of directories in a text file I am trying to do some work with and keep getting this error after reading them into a Powershell script and trying to do directory related tasks with them (...
-1
votes
0
answers
54
views
How to put the status of a big entity into a variable in powershell? [duplicate]
when I run the following code in powershell:
cls
$Name = "SQL_PerfMon_DeepDive" # <-- your set name
logman query $Name
I get the following result:
How can I get the status bit in red ...
4
votes
0
answers
80
views
How to effectively search $home in PowerShell if you are looking for hidden directories?
I am writing a Powershell script which has a function:
$CutFiles3 = @(Get-ChildItem $home -Force -Directory -Filter autoruntemp*)
This command is slowing down my script and is taking 10 seconds to ...
-3
votes
1
answer
67
views
How to run this Powershell example from Microsoft website?
It is amazing how the richest software company in the world, Microsoft, is incapable of producing documentation examples that work. Well, I mean their purpose is just to take your money, not really to ...
1
vote
3
answers
57
views
StartTime format for FilterHashtable in powershell?
So, I found Time range with Get-WinEvent | Windows 11 Forum:
This is one way to get Events in a particular Log between two particular dateTimes:
eg:
Get-WinEvent -ListLog Application | % {Get-...
3
votes
1
answer
111
views
In a VS Code monorepo with multiple workspace roots, How can I set terminal.integrated.cwd to default to one workspace root?
I have the following monorepo structure in a VS Code Workspace:
MyModule
└── File A
└── Folder A
└── Etc...
ModuleWrappers
└── File B
└── Folder B
└── Etc...
PSProfile
└── File C
└── File D
└── Etc...
...
4
votes
1
answer
95
views
MECM script on new laptop rename and add domain user as with local admin permission on the laptop
hope you are all good and wish you all a merry christmas.
I am currently having a problem with a script that I need to run on MECM.
My scenario is as follows, there is a new laptop in the company and ...
2
votes
0
answers
100
views
Using MethodRental's SwapMethodBody on powershell classes
I recently discovered MethodRental and it seems really interesting, coming from JS, being able to pre-empt existing functions can be a neat hacky get-out-of-jail card for the toolbelt.
As an aside, ...
3
votes
0
answers
73
views
VS Code extension fails on Windows: git: 'Files\Git\cmd\git.exe' is not a git command when running PowerShell command [closed]
I am not asking about PowerShell syntax itself.
The PowerShell command shown below is executed internally by a VS Code extension
(Kilo Code) as part of its environment detection. The command itself ...
Advice
0
votes
7
replies
115
views
PSCore alternatives for ConvertFrom-String
PSCore (7+) removes the ConvertFrom-String cmdlet. Is there any alternative module or method for it?
0
votes
1
answer
63
views
Connect-AzAccount : ManagedIdentityCredential authentication unavailable. No Managed Identity endpoint found
Background
I have a PowerShell test script that uses azuresigntool.exe to sign a file using a certificate in an hsm-backed azure key vault (Azure Key Vault - Premium tier). The certificate is a ...
1
vote
1
answer
117
views
WARNING: Unable to encode the output with cp1252 encoding
I am trying to run a powershell script on Microsoft hosted agent "windows-latest" (azure pipeline), It uses below az cli command:
$projects = az devops project list --organization "...
3
votes
2
answers
116
views
Powershell 7.4.5 attempting Add-Type of Oracle.ManagedDataAccess.Core gets error loading System.DirectoryServices.Protocols
I am attempting to write a script to connect and load an Oracle database in Powershell 7.4.5. The issue is when attempting to
Add-Type -Path <Path to ManagedDataAccess.(Core)dll
Powershell throws ...
1
vote
1
answer
128
views
How to retrieve all Microsoft Defender for Cloud recommendations for a specific Azure resource using PowerShell?
I am using Microsoft Defender for Cloud in Azure and I want to centrally retrieve all security recommendations for a specific Azure resource (for example, a VM, Storage Account, or App Service) ...