powershell Questions
3
I need to have a timeout in powershell code where I'm running batch file, in case the batch file runs for a longer time or gets stuck. I also have a timeout in the batch script timeout 300> nul ...
Pulsation asked 18/12, 2022 at 16:35
3
Solved
I have a simple question regarding why something works the way it does and I cant seem to readily find out why.
I was trying to run the following command:
foreach($a in $list){set-mailboxcalendarp...
Ileenileitis asked 18/11, 2014 at 0:37
5
Solved
I am really fond of python's capability to do things like this:
if __name__ == '__main__':
#setup testing code here
#or setup a call a function with parameters and human format the output
#etc....
Frugal asked 14/1, 2011 at 17:24
2
Solved
We define a new Windows firewall rule for some program to accept inbound TCP connections on some port. This can be done using either netsh.exe utility or Powershell New-NetFirewallRule cmdlet. For ...
Pitiful asked 13/2, 2016 at 21:30
5
Solved
Trying is use cmdkey in a PowerShell logon script to store credentials in the credential manager. When the script is run from PowerShell ISE everything works, but when it's run as a logon script vi...
Keratoid asked 19/8, 2014 at 12:45
2
Solved
How can I make Powershell behave like Bash with its flag set -e? set -o errexit makes a Bash script "Exit immediately if a simple command exits with a non-zero status".
I thought I could do this ...
Chaste asked 12/7, 2012 at 10:44
8
Hoping someone maybe able to help with the below error i get when running a powershell script i created. It worked before fine no issues.
"The Operation being Requested was not performed becau...
Soldiery asked 30/10, 2020 at 10:51
6
Is there a way to list only packages installed specifically with the winget command?
winget list
seems to show all packages installed on the machine.
I am changing my computer and I want to get a l...
Ringsmuth asked 24/1, 2023 at 23:23
7
Solved
I have a .env file like this one:
TESTCASE_GROUP_SIZE=25
. . .
And I want to get its value (read it) into a .ps1 script.
How can I do it?
Neuman asked 14/5, 2022 at 0:46
4
Solved
I am trying to download a Google sheet via a batch file. This works:
powershell -Command "Invoke-WebRequest https://docs.google.com/spreadsheets/d/SPREADSHEET_ID/export?exportFormat=tsv -OutFile o...
Kemme asked 28/2, 2019 at 1:40
7
Solved
I want to download the SSL certificate from, say https://www.outlook.com, using PowerShell.
Is it possible? Could someone help me?
Revealment asked 6/3, 2014 at 19:7
15
Solved
I'm trying to get the physical memory size using PowerShell, but without using get-wmiobject.
I have been using the following PS cmdlet to get the physical memory size, but the value changes with ...
Fleshings asked 16/7, 2013 at 15:50
7
Solved
I'm using PowerShell script to run C# code directly in the script. I've run in to an error a particular error a few times. If I make any changes to the C# code in the PowerShell ISE and try to run ...
Fenella asked 8/9, 2014 at 18:42
2
Solved
I'm trying to write a piece of code to drop and re-create an MS SQL Database in PowerShell using some Invoke-Sqlcmd commands (caused by an error in our systems). I wanted to build some contingency ...
Doane asked 11/9, 2015 at 11:57
4
Solved
I am working with deeply nested JSON and, after convertfrom-json, need to be able to traverse through various parts of the object which the convertfrom-json cmdlet generates.
I have no way of knowi...
Shinleaf asked 3/10, 2020 at 17:26
2
Solved
Given I have:
$a = "world"
$b = { write-host "hello $a" }
How do I get the resolved text of the script block, which should be the entre string including write-host:
write-host ...
Cytolysin asked 8/3, 2019 at 12:48
10
I want to start and stop application pool in IIS using powershell script. I had try to write the script but i didn't get this.
Narcotize asked 13/4, 2016 at 13:10
4
Solved
I am trying to build a "type", for the Timecode convention used in Film/Animation.
I want to accommodate use cases where a user may want to initialise the object with a Timecode string go...
Recusancy asked 5/9, 2023 at 19:30
4
Solved
How do redirect
stderr to logfile
stdout to object
Things I've looked at:
>> and 2>> only redirect to file .
-RedirectStandardOutput and -RedirectStandardError only redirect to f...
Downcomer asked 13/7, 2017 at 4:43
3
How can I implement a get/set property with PowerShell class?
Please have a look on my example below:
Class TestObject
{
[DateTime]$StartTimestamp = (Get-Date)
[DateTime]$EndTimestamp = (Get-Date...
Resolution asked 27/9, 2016 at 6:12
5
There was no problem with WSL1. I wanted to upgrade to WSL 2.
Command line fails when I try to upgrade to wsl2. I tried to remove Ubuntu and reinstall it, no difference.
Virtual Machine Platform...
Teutonism asked 28/4, 2020 at 19:50
3
Solved
I've got this beautiful one liner which calls a webservice of mine via Task Scheduler:
-ExecutionPolicy unrestricted -Command "(New-Object Net.WebClient).DownloadString(\"https://127.0.0.1/xxx\")"...
Flick asked 17/12, 2015 at 9:39
5
Solved
I've problems to get the ParentProcessID from a Process where I have the ProcessID. I tried it like this, this is how it works with the ProcessID:
$p = Get-Process firefox
$p.Id
But if I try it ...
Card asked 25/11, 2015 at 8:9
7
Solved
In a serious intiative to migrate all my command line operations to PowerShell, I would like to avoid using the old fashioned command console for anything. However, the Visual Studio Command prompt...
Minatory asked 9/12, 2010 at 12:22
7
Solved
I have a very powershell script that works perfectly and does:
Param(
[string]$fileName
)
echo "Woo I opened $fileName"
When I run it on the command line, it works:
my-script.ps1 .\somefile
...
Ricer asked 16/1, 2018 at 11:42
© 2022 - 2024 — McMap. All rights reserved.