Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Questions tagged [powershell]

PowerShell is a cross-platform command line and scripting utility from Microsoft. Use this tag for questions about writing and executing PowerShell scripts ONLY. Programming questions specific to the cross-platform version PowerShell Core (Windows, macOS, and Linux) should be tagged [powershell-core]. Questions about system administration should be asked on Super User or Server Fault.

Filter by
Sorted by
Tagged with
0 votes
0 answers
10 views

How to write a Choose function in powershell to edit the pipeline?

I wish to edit the git sparse-checkout information inplace using the nvim editor. I have the following code that almost works. function Choose () { begin { $file = New-TemporaryFile } ...
user avatar
1 vote
0 answers
15 views

How can i pass a value from a Groovy script to other build steps in a Jenkins Freestyle Job?

I have a step in my Jenkins freestyle job that runs a Groovy script as follows: import java.nio.charset.StandardCharsets; def creds = com.cloudbees.plugins.credentials.CredentialsProvider....
user avatar
  • 41
1 vote
1 answer
29 views

McAfee Consumer Product Removal Silent Script

I made a script that works some of the time to remove McAfee products. The issue is that there are sometimes 2 tmp folders that get created. Then, there's a chance that it renames and copies the wrong ...
user avatar
0 votes
0 answers
14 views

Pass Azure Automation Runbook Webhook Body to Logic Apps

I have created a webhook in Azure Automation. I am looking to pass the body when the webhook is called to a logic app. Please see the powershell code designed of runbook. param ( [Parameter(...
user avatar
0 votes
1 answer
28 views

Did I do this PowerShell problem correctly?

Can someone check to see if I did this PowerShell problem correct? Also, if you answer it could please explain what I did wrong. That will help me to continue to learn. Thanks! Problem 3.) ...
user avatar
  • 15
1 vote
2 answers
35 views

Returning system array then using it Powershell

I have the following function that gets a list of folder names and displays the results in a tabular fashion. Once that is done, I want to iterate through that list to do different things depending on ...
user avatar
1 vote
1 answer
31 views

Suppress Error Messages in PowerShell at get-package

I use PowerShell to check, if specific apps are installed on the users PC: $Application_MicrosoftEdge = get-package "Microsoft Edge" | % { $_.metadata['installlocation'] } $...
user avatar
  • 57
0 votes
1 answer
36 views

Compare Array with string value

I am just starting to use Powershell ) I need to compare the file name with a list of file names to exclude some files from further transfer . This script I wrote : $E_list= @("**a8e4022a-41c4-...
user avatar
0 votes
0 answers
46 views

Setup and deploy Azure function using PowerShell

I try to setup and deploy Azure Function by using PowerShell script based on this topic: Setup Azure Function from PowerShell My script looks like this: #=============Defining All Variables========= $...
user avatar
0 votes
1 answer
29 views

Check, if an specific App is installed using PowerShell

I want to check via PowerShell, if a specific product (like "Office" or "Visual Studio") is installed on the target computer, but I can not use any 3rd party PowerShell modules (...
user avatar
  • 57
1 vote
1 answer
27 views

How to create Azure VM without NSG?

I want to create a VM without nsg. In the New-AzVm cmdlet, I specify $null in the PublicIP parameter - and it works (i.e. it does not create a Public IP). But this does not work with nsg. Here is my ...
user avatar
  • 19
0 votes
0 answers
25 views

Copy folder and subfolder by filter PS

I've been trying for a while and still haven't got the solution Can anyone help me with a Powershell script to go over all the folders inside a path and copy all the subfolders with specific name for ...
user avatar
-1 votes
1 answer
28 views

Powershell - Sort files in new folders by yyyy-mm structure [closed]

I want to sort a lot files in a new folder location with subfolders. For example files in C:\source should be copied to \server\destination by creating subfolders according the file creation date like ...
user avatar
0 votes
1 answer
21 views

HTML error with creating VM snapshot report to email it to my self

I got the below PS script Idea online to create a VM Snapshot report and email it to myself every morning, once I run the script it will get the below error message, can someone help me with that? ...
user avatar
  • 13
0 votes
1 answer
21 views

check if artisan file exist in current directory using PowerShell

I want to check if artisan file exist in current directory to set an alias . take a look what i tried but without any results. if ( (Test-Path -Path $pwd -Include artisan) -eq $true) { Function ...
user avatar
  • 432
0 votes
2 answers
42 views

powershell hashtable (export-Csv) to CSV

The following code in powershell creates a file with key/value pairs. $result = @() Get-EventLog -LogName Security -After ((Get-Date).AddDays(-5)) -InstanceId 4624 | ForEach-Object { if ($_....
user avatar
0 votes
1 answer
55 views

scrapy : The term 'scrapy' is not recognized as the name of a cmdlet?

I am looking for a python script that searchs for a (specific word) in the entire Web page. So after I look around youtube I found youtubers saying "Scrapy is better then bs4". So I tried ...
user avatar
0 votes
0 answers
13 views

Domain joining Windows with a smart card (CredMarshalCredential / PSCredential)

I'm attempting to domain join a bunch of workstations (ideally remotely, via Powershell). The problem is I'm forced to use a Smart Card to accomplish this. The problem is that it appears that the ...
user avatar
0 votes
0 answers
13 views

Can I log into Windows OpenSSH with default shell as pwsh.exe?

I can't login to Windows OpenSSH is my default shell is not powershell. If it is, then reg add HKLM\SOFTWARE\OpenSSH /v DefaultShell /d C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe makes ...
user avatar
1 vote
2 answers
32 views

What is the fastest way to rename csv header names using PowerShell?

I am trying to automate the process of rename the csv header names. I used the following script, but the script is taking very long time to complete the rename process especially when the file size is ...
user avatar
  • 1,856
1 vote
1 answer
38 views

Can't delete Windows folder that contains a subfolder named "..." which contains a subfolder named "..." etc

I'm stumped. I have a folder called c:/data/ToDelete. It used to contain files as well as a single subfolder called ..., which contained the same files as well as single subfolder named ... and this ...
user avatar
  • 161
0 votes
1 answer
45 views

Powershell not showing node text if node has attributes

I try to process Peppol xml invoices. Sometimes the same node has attributes and sometimes does not. How can I get the text of a node regardless of it having attributes? $xml=[xml]@" <Invoice&...
user avatar
0 votes
0 answers
18 views

powershell does not catch Set-Location error

Why is error not catched when I use ? try { Set-Location "c:\non-existing-path" } catch { Write-Host "cannot find path" }
user avatar
  • 35.4k
0 votes
1 answer
25 views

How to exit PowerShell on a keypress, after the program has been executed?

I am trying to build a custom sublime-build that executes c++ programs in powershell. I want powershell to exit itself on pressing enter or any other key. How can this be done ? This is my sublime-...
user avatar
-1 votes
0 answers
15 views

Ubuntu Status Stopped how to get Running status in powershell?

I have run wsl --install in windows powershell then I am getting this error. On first time when I run this code it installed and when I restart it started installing Ubuntu but I wait almost more than ...
user avatar
  • 1
0 votes
1 answer
37 views

Regex in powershell not matching regex101

Trying to get data from crystal disk text file, in order to sort through the data i need to find out how many disks there are, when doing this in regex101 it gets the data fine but when i move this ...
user avatar
0 votes
2 answers
23 views

Powershell API - Passing a variable inside of a variable

I'm struggling on how to pass a base64 encode inside my API function. It works if I pass manual strings. But I want to dynamic strings. Here is my code: $base64string = [Convert]::ToBase64String([IO....
user avatar
  • 1
0 votes
0 answers
23 views

The type initializer for 'System.Management.Automation.ExpirementalFeature' threw an Exception

I am trying to execute a PowerShell script with C# with the System.Management.Automation.Powershell object in a kiosk environment, but I am always getting an exception and I have found nothing about ...
user avatar
1 vote
1 answer
26 views

Powershell: converto-html separate values onto new lines

I'm building a script that will create an html report containing a table with multiple values in each Column Row (e.g. given cell may have 1 or more values). I'm building my output variable like this ...
user avatar
  • 11
0 votes
0 answers
23 views

How to fix connection failing in PowerShell

We are running our PowerShell Script in Remote Windows Server 2019. We use Connect-AzureAD and Connect-IPPSsesion. The script took about 3 hours to complete the whole process. It was working fine a ...
user avatar
  • 213
1 vote
3 answers
66 views

How to calculate using a for-loop with odd numbers and print only average

I need some help with a problem. Problem: Using a for loop, compute the average of the first 20 odd numbers. Print only the average. I have figured out how to count the first 20 odd numbers in the for ...
user avatar
  • 15
0 votes
1 answer
17 views

How to print process ıd in event log?

Im trying to get process id from my Get-Eventlog. I can not parse the process id from the message. How ı can get it from there ? I tried With Select string -Pattern but it did not worked. My ...
user avatar
0 votes
0 answers
32 views

Powershell start-process use array as argumentList input

I use Powershell (version 5.1) to write a simple GUI frontend, and use the "start-process" cmdlet to start the backend program. However, when passing the parameter with "-ArgumentList&...
user avatar
1 vote
0 answers
57 views

Powershell fails to use keyword 'param' in the second calling function

function param-simple { Param([string]$user_, [string]$host_, [Parameter(position=0,ValueFromRemainingArguments)]$params_) write-host "[*]user: $user_" write-host "[*]host: $...
user avatar
0 votes
0 answers
11 views

Possible to Highlight in Pycharm Terminal like VS Code?

Is it possible to highlight words in the terminal as VS Code does? I want to be able to quickly be able to "ctrl+shift+left arrow" and select a word or multiple words and change them quickly ...
user avatar
  • 47
0 votes
2 answers
25 views

Powershell | Bypassing Syntax Rules Applying to Serial Command

I have a PS script written to apply some basic configuration to a device over a COM connection. After some user input is recorded, it is used to format a minified java string to send to the device ...
user avatar
0 votes
0 answers
35 views

Importing CSV values with custom number formatting

I have a csv file with a timestamp column that has a custom number formatting in this format mm:ss.0. I am trying to change that custom number formatting to h:mm:ss AM/PM, preferably during the Import-...
user avatar
  • 13
0 votes
0 answers
39 views

Why does VS Code Terminal terminate shortly after open with various error codes depending on terminal type?

My VS Code keeps shutting down the terminal. (30 s up to 5 min after I open it.) I've tried: Reinstalling VS Code with deleting the folders %APPDATA%\Code, %USERPROFILE%\.vscode Using different ...
user avatar
0 votes
0 answers
20 views

Azure Runbook - automation account - "ErrorActionPreference" or common parameter is set to Stop: Resource group 'XXXX' could not be found

I am receiving the following error: The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: Resource group 'GFPS-P-EUW-RG-...
user avatar
1 vote
2 answers
36 views

Can't run icacls to a directory with spaces

I'm trying to run a simple icacls to a directory on my computer and I'm facing this error: PS C:\Users\gguer\Documents> icacls.exe '.\My Digital Editions\' .\My Digital Editions": The ...
user avatar
0 votes
0 answers
23 views

node command freezes Powershell, but works fine in Command Prompt

node command freezes Powershell, but works fine in Command Prompt as shown in the screenshot below: I'm new to node.js and today I've installed node-v16.16.0-x64.msi from https://nodejs.org/en/ and ...
user avatar
  • 155
1 vote
3 answers
31 views

Remove column of array of object

I have an array with psocustomobjet like this : $Data=@() $Data += [PSCustomObject]@{ 'RawMessage' = '123' 'MessageType' = 'String' 'Export' = ''} $Data += [PSCustomObject]@{ 'RawMessage' = '456' '...
user avatar
0 votes
2 answers
51 views

VS Code Powershell "←]633;P;IsWindows=True"

I am working on a web application using Angular in Vs code. I ran into some errors while I am fixing them in the process my vscode is bricked after a couple of minutes it return to its normal state ...
user avatar
1 vote
1 answer
40 views

How to find UPN that contains digit?

i would like to know how to find UPN that constain digit with -filter? Get-ADUser -filter {(UserPrincipalName -contains "I dont know what i should add here @contoso.com")} -properties ...
user avatar
  • 153
1 vote
0 answers
43 views

loop over parameterized rest api call

I'm trying to do a history load of data from a ReST api call using powershell. If I were to call the ReST endpoint with no parameters I either run into timeout or out of memory exceptions. $Header = @{...
user avatar
  • 851
0 votes
0 answers
145 views

Azure Runbook - The subscription name XXXX doesn't exist. - I don't understand why

When I run the runbook it appears the following message: Exception of type 'System.Exception' was thrown. The subscription name XXXX doesn't exist. Parameter name: name It's just a simple script to ...
user avatar
0 votes
0 answers
18 views

Error running djoin.exe. Return code: -2147023174

Can someone explain what this error code means ? Below command is executing BY CODE - djoin.exe /provision /reuse /domain userDomain /dcname targetDC /machine machineName /savefile c:\rabins\...
user avatar
1 vote
3 answers
43 views

Powershell - Efficient way to keep content and append to the same file?

I want to keep the first comment section lines of a file and overwrite everything else. Currently this section is 27 lines long. Each line begins with a # (think of it as a giant comment section). ...
user avatar
  • 103
0 votes
0 answers
28 views

How to get a full file path including extension from OneDrive using PowerShell

I've this PowerShell Script that get the folder name, Folder path and last modified from either SharePoint Online or OneDrive account but I'm just wondering how can I also get the the file name inside ...
user avatar
  • 213
0 votes
0 answers
7 views

PowerShell New-GPLink is giving the errors on cross domains

I am trying to write a PowerShell script to link my GPOs to several OUs on multiple domains. The issue I am having is with the New-GPLink cmdlet. When I run the command I get different errors. I can ...
user avatar

1
2 3 4 5
2109