119,246 questions
0
votes
1
answer
41
views
PowerShell script that alerts on unexpected restart/shutdown only
Hi I have a PowerShell script I have been looking into over the last week, The script alerts me if a server has been rebooted/shutdown and shows me the following event ID related to reboot or shutdown ...
1
vote
3
answers
67
views
PowerShell Strings from headers is this possible?
I'm trying to create a script to make reading a CSV easier for a task I'm carrying out.
E.g. I have a csv with the following headers and values
Value1,Value2,Value3,Value4
10,20,30,40
11,12,13,14
I'...
5
votes
2
answers
168
views
What exactly does the Comma operator "," do
The formal description of the comma operator (,) is:
As a binary operator, the comma creates an array or appends to the array being created. In expression mode, as a unary operator, the comma creates ...
3
votes
2
answers
114
views
The `MatchCollection` type returned from `[regex]::Matches()` which implements `ICollection` and `IEnumerable` does not support the `[-1]` array index
I'm sure this is on here somewhere, but it did not appear in the top 100 search results. It's hard to search for.
But basically The [regex]::Matches() function returns a MatchCollection type object ...
0
votes
0
answers
36
views
Trying to get a PS script to monitor and log NIC connection drops [duplicate]
I want a simple Powershell GUI, to have the local computer let me know when any of its NICs drop connection. The results should be a .csv file, stored in a folder named NIC_Drops, located in the root ...
2
votes
1
answer
100
views
PowerShell script email layout
I have crated a PowerShell script that sends me an email alert when a server reboots/shuts down, and shows the event ID related to the reboot/shutdown event (e.g. clean reboot "Event ID 1074 or ...
Advice
0
votes
7
replies
45
views
PowerShell script not running on startup
I have created a PowerShell script that alerts me via email when a server reboots/shutdown, it sends a message and shows me the specific event ID related to the reboot/shutdown event.
It works ...
1
vote
0
answers
71
views
Context Menu: Open with Command Prompt (Classic) [closed]
Lately, Windows 11 is becoming increasingly bloated. Everything appears to load with some form of lag and I've notice this happening in Windows Terminal.
Windows Terminal allows you to right-Click ...
1
vote
1
answer
106
views
Invoke-command with single quotes in ScriptBlock
As part of a script I'm working on, I need to call a NetBackup command via PowerShell using invoke-command.
The command should be like so:
& c:\NetBackup\bin\admincmd\bpflist -d $startDate -e $...
Advice
0
votes
2
replies
52
views
Set-Alias: A positional parameter cannot be found that accepts argument 'pull'
I was trying to create an alias in PowerShell.
I am using PowerShell version 7.5.4 and used the command:
SET-ALIAS -NAME gips -VALUE git pull origin \<branch_name\>
When I ran the GET-ALIAS -...
16
votes
1
answer
894
views
Why does the command prompt appear on a new line after C program execution, even without \n?
I am running a simple C program on Windows using VS Code and the PowerShell terminal. My code intentionally does not include a newline character (\n) at the end of the printf statements.
Code
#include ...
0
votes
1
answer
90
views
Cannot use Certutil to get specific info on certificates [closed]
I am writing a powershell script to get a csv of information about certificates from a certain CA. I have been using this command:
$output = certutil -config $caName -view -out "RequestID, ...
2
votes
1
answer
78
views
how to control verbosity of modules auto-load action?
I created a Helper module with some handy functions. This module itself needs a few other modules to run.
In my scripts, I import it with Import-Module Helper -Verbose:$false so even if the outer ...
-3
votes
0
answers
70
views
How to run powershell commands on devices with powershell/cmd restricted by admin [closed]
I'm making a small app for Windows that uses powershell for some tasks.
It occurred to me that in some corporate environments the admins may disable ps/ cmd for normal users. In that case how does one ...
0
votes
1
answer
32
views
Need help filtering proxyAddresses by domain in a specific OU
I want to export, for users located under a specific OU, only the entries in the proxyAddresses attribute that belong to a specific domain (e.g., only addresses ending with @domain.co.uk).
I tried a ...