119,246 questions
0
votes
0
answers
32
views
I am running Ollama (a local LLM service) on Windows and need to programmatically detect which port it's currently listening on
What I've tried:
Using Get-NetTCPConnection but it returns too much information and I can't reliably filter for Ollama:
Get-NetTCPConnection -State Listen | Where-Object {$_.LocalPort -gt 11400}
...
0
votes
0
answers
37
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
57
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 ...
-1
votes
1
answer
48
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
42
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
99
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
93
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
97
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
69
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
109
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
61
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
112
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
115
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
121
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) ...
0
votes
0
answers
102
views
Powershell's Az-GetStorageBlob cmdlet returning inconsistent results on different environments when blob does not exist
I have 2 different Windows VMs, both with the same version of the Az module (15.1). I am executing the exact same script on both.
At a point in the script where the Get-AzStorageBlob cmdlet is called, ...