Questions tagged [powershell-ise]
PowerShell-ISE refers to Microsoft Windows PowerShell's Integrated Scripting Environment.
519
questions
0
votes
1
answer
47
views
Deleting users in C drive and registry using PowerShell ISE
Code is not actually deleting users from the drive/reg
I did a little research and found some base code that I modified to apply to my situation at my job. Old users are a constant issue that I have ...
0
votes
1
answer
55
views
MacOS: Debug Powershell script admin privilege in VSCODE ISE
Using MacOS (M2 Chip):
I've Powershell script which I need to run as Administrator (sudo).
To debug the script I need to run the script in Debug mode from the pwsh prompt --but I don't know how can I ...
1
vote
1
answer
62
views
Trying to get a command to run in cli from a powershell script but it is picking up an "ambiguous" parameter
I am currently trying to get a command that I know works in CLI to run through a PowerShell Ise script but it will not allow me to run it as it is picking up a part of the command as a parameter.
I ...
1
vote
1
answer
104
views
Exception setting "TreatControlCAsInput": "The handle is invalid. in Windows PowerShell ISE
We have a PowerShell script that contains "[Console]::TreatControlCAsInput = $true". The script is executed in a Azure DevOps Pipeline and fails with
Exception setting "...
1
vote
0
answers
24
views
Powershell objects assigning values to object on the 'right side' of 'equal character' [duplicate]
I have a powershell script running steps such as
$stuffFromAPI = $resultsFromAPI.inputs.Stuff | ConvertFrom-Json
$objectFromAPIStuff = $stuffFromAPI.item[0] #ipAddress = 127.0.0.1
$newStuff = @()
$...
0
votes
0
answers
87
views
Find (Ctrl+F) dialog window in PowerShell ISE in Windows 11
In PowerShell ISE in Windows 11 (clean install), the Find dialog box no longer searches by pressing the Enter key. It appears the "Find Next" button is no longer set as the default button ...
0
votes
0
answers
84
views
PowerShell ISE Code to Visual Studio Code // Azure-AD Connection
I have the following Powershell-Script I wrote, which is working fine in Powershell ISE.
The problem is, I need it working in VS Code.
What is the script doing?
Well, it connects to an Azure Active ...
1
vote
1
answer
66
views
Remove leading timestamp (minutes) from PowerShell ISE
I am using PowerShell ISE and when I get an error, this weird timestamp is leading the error message and this is starting to get annoying.
Command:
PS C:\Users\serhat> terraform plan -var="...
0
votes
0
answers
12
views
Creating OU in PowerShell ISE
I wrote a script based on the guidelines given to me, however I am getting some errors.
This is the script I have:
$aryText = Get-Content -Path "C:\Users\Administrator\Documents\stepbystep.txt&...
0
votes
0
answers
43
views
Get-WindowPosition -Window doesn't work with Variable but does if constant is used
This one's got me completely stumped.
(New-Object -ComObject 'Shell.Application').Windows() |
ForEach-Object {
if ($_.locationName -contains "My Documents") {
$...
0
votes
0
answers
58
views
Powershell: start multiple processes and put them in a list and observe them
i want to create some Powershellscript where i can add a uncertain number of processes to a list.
After that i want to observe, if the processes are finished.
so i created this:
$procs = New-Object -...
0
votes
1
answer
471
views
Checking active users in on-Prem AD via PowerShell - how can I do this via a CSV import?
I have a huge list of users that are present within an application, and I need to check whether all of them are present within on-Premises Active Directory. There's no way I'm going to be copying/...
0
votes
0
answers
62
views
How can I search for an PID for using an explicit handlename?
My goal is to search all Process from every user and search if someone is using an explicit dll that I already know at the start of my script. And when a User is running a Procces in which my ...
0
votes
1
answer
184
views
PowerShell - Populate my listbox with a selection made in drop down list
I am trying to make an Application Deployment tool on PowerShell ISE by pipelining the data through Active Directory for admins. Since Active Directory doesn't have a feature of fuzzy search, I ...
0
votes
0
answers
178
views
Powershell ISE: Trying to execute a file.cmd to run:
I'm new to powershell and I wanted to run a cmd file from powershell ise to start the file.cmd but I can't get the actual file to start running
I'm trying to call my file.cmd to run. This is ...
1
vote
0
answers
18
views
How to run a ps1 script from .net core web api [duplicate]
Here I've tried to create database out of the .bacpac with the help of .NET Core Web API using a PowerShell script. All I want to do is to pass dynamic parameters to the script from the API to create ...
0
votes
0
answers
79
views
Error querying artifacts: An existing connection was forcibly closed by the remote host
I got the script that just needs to be runned, but it throws some errors.
artifactUrl already exists, script shouldn't be a problem
Console:
Console
I should've got a new container with url and other ...
0
votes
0
answers
311
views
DBATools and Overload SQLCommand and a clean ISE session
I have an older server with Powershell ISE, where I can't easily install vscode.
I am trying to run DBATools.io's invoke-dbaquery using the ISE, but I get 'cannot find an overload for "sqlcommand&...
1
vote
1
answer
719
views
Writing a PowerShell script to copy directory and its contents to all users documents folder
First, this is my first REAL question on stack-overflow so here we go:
I am trying to use Get-ChildItem and Copy-Item to copy a directory and its contents to every user-profile that may be on a PC ...
0
votes
1
answer
37
views
Remove just the last "." in line
I don't now how to remove just the last "." in the end of line and don't impact the others "." in middle of line, this is an example :
"1","php.ect.D221211.T222012....
0
votes
0
answers
50
views
Where can I find more detailed help for ShowUI in Powershell?
I am unable to find clear information anywhere on how to use the ShowUI functions. I've created a function that searches for movie information in an effort to easily update my movie list. The ...
0
votes
2
answers
230
views
Get all files named month by month
i have system of log that write logs each day with this format: "stat.dat_20220901_235900.txt","stat.dat_20220902_235900.txt",...
i need to get content of all files by month and ...
0
votes
0
answers
130
views
Map names for properties in Get-WinEvent
When I do this request
Get-WinEvent -FilterHashTable @{LogName='Microsoft-Windows-TerminalServices-Gateway/Operational'; Id=307,302,303; StartTime='01.11.2022 0:00:01'} | Select-Object TimeCreated, ID,...
0
votes
0
answers
39
views
Program completes even before completing all the Jobs and CPU memory continues to increase
I have created a PowerShell Program to execute multiple sql script files:
Below is my code in PS:
cls
$SQLSERVER = 'Servername'
$DATABASE = 'DB'
$USERNAME = 'Username'
$Password = 'Password'
$...
2
votes
2
answers
441
views
Change the default "Edit" action for .ps1 from ISE to VS Code
Like the person in this question, it is frustrating that such obvious things have no clear answers (I've looked at 20 pages and found nothing yet).
The default right-click "Edit" action in ...
3
votes
2
answers
72
views
While working in Powershell, how do I pause between list items?
I have been working on this for a while and I cannot find this utilization anywhere. I am using a powershell array and the foreach statement:
@('program 1','program 2','program 3').foreach{winget ...
1
vote
0
answers
176
views
Does powershell have a "netonly" equivalent?
I want to open AD from a different domain. Earlier i used this to do so:
runas /netonly /user:xxxx\xxxx "mmc dsa.msc /domain=xxxx"
Which worked fine but i wanted to make it into a GUI to ...
0
votes
2
answers
709
views
Try/Catch Script Failing to output $error to file
I am working on a script which will do the following:
Check if a service (in this case XboxGipSvc) is running
If service is running, do nothing
If service is not running, attempt to start service
If ...
0
votes
1
answer
401
views
AD Group Membership Export to separate columns
I'm looking to make a (hopefully) simple CSV or XLSX that I can use to compare two users' AD group memberships via PowerShell ISE. Currently, it's a bit extensive, though mostly this has been the &...
-2
votes
1
answer
329
views
move tab to another from several edge window at once with powershell
I have two windows Microsoft edge that have two tabs each. so I want to make PowerShell script when its run, the tab move to another tab in each edge.
0
votes
1
answer
63
views
How do I return the values of searched items in powershell instead of the object?
How do I fix this issue?
I am working on a code that will copy all of a single filetype (ie. txt, jpg, etc) to a single location so that I can suss out duplicates and manipulate them in one place. I ...
0
votes
0
answers
77
views
Powershell and VSCode Terminal issue
I'm having an issue regarding the Powershell extension in VSCode. I am getting a blank line, and a different command for the script being executed.
I get this on vscode:
PS>
PS>. "C:\...
2
votes
1
answer
544
views
Executable output works fine in PS console, but not in Powershell ISE?
I have an SAP program call sapgenpse.exe.
If i excute the below command from powershell command, the output is perfect.
But if i do the same operation in powershell ISE, the output breaks abruptly.
0
votes
3
answers
444
views
Move Files to a Backup Folder every first in the month and Zip the Files
I have never worked with powershell and I only need a program that is always run at the beginning of the month
What should the program do?
At the beginning of the month it should move all data except ...
0
votes
0
answers
110
views
Return Powershell ISE to the main window
I have written a script that starts by calling Firefox several times, then calls "a read-host". My problem is that I would like ISE or the console to come back in front of the other open ...
0
votes
1
answer
3k
views
What is the equivalent of $PSScriptRoot in Powershell ISE?
I am working on some scripts in Powershell ISE and I need PS script root to behave the same in Powershell and Powershell ISE. I made the following example to show the difference.
Caller.ps1
if ($psISE)...
1
vote
1
answer
1k
views
Script runs with ISE but not via PowerShell console
I have a script that runs smooth with ISE but stops when running via PowerShell console. Error raised:
You cannot call a method on a null-valued expression
So here is the code sample (can't show it ...
1
vote
1
answer
265
views
Do PowerShell ISE scripts produce system calls altering the entire OS down to the kernel?
I'm a complete rookie to programming. I will say so much off the bat: please go easy on me. I simply want to know what happens on a system-wide level when I run a script through the PowerShell ISE ...
0
votes
1
answer
770
views
python not running in powershell ISE [duplicate]
when I type 'python' in either Windows powershell or the Command module (Windows 10), I get into the python environment. However, when I try the same in Windows Powershell ISE, I get an error message ...
0
votes
2
answers
352
views
Get list of a directory with powershell. With Created and Modified columns
I have this code:
Get-ChildItem -recurse | fl name, creationtime, lastwritetime
And i get a result of this:
Name : name.exe
CreationTime : 18-Dec-21 13:15:16
LastWriteTime : 18-Dec-21 13:...
0
votes
1
answer
881
views
Split multiple strings from a text file to create an array in powershell
I'm very new to Powershell ISE and I'm not sure how to go about doing this.
I want to take strings (uxxxx axxxx name email) and have it return as a table with username, admin, and name (want to ...
0
votes
1
answer
164
views
How can I handle the remote server message by PowerShell?
I created a short PowerShell scrtipt in order to import a .reg file (an ODBC) to another server session.
I faced to this warning/issue.
The message is this (below):
The operation completed ...
0
votes
1
answer
36
views
How to query the user for an AD account name, then use the input in the following PS Script?
What I'm trying to accomplish here is relatively simple, but I'm not sure how PS does it.
I'm making a script that will, eventually, take user input, for example, an AD User account, then use that ...
-1
votes
1
answer
702
views
write PowerShell script to count number of special char and space present in a text file and replace them with tab
Text file name "test.txt"
Present file content
hello!my@name$is*swaraj mohapatra
11!12#13%14$
Required file content
hello my name is swaraj mohapatra
11 12 13 14 15
Output:
This file ...
0
votes
1
answer
310
views
Script working from powershell ISE but not from powershell
I am trying to connect to vsphere using powercli and the powershell script contents are below,
# test.ps1
Set-PowerCLIConfiguration -Scope User -InvalidCertificateAction Ignore -Confirm:$False
Connect-...
0
votes
1
answer
259
views
API response code is invalid in powershell script
My web application is having a serious issue with app pool. Sometimes, my API application is giving 500 errors and not sending any responses for any request. There are no logical or other runtime ...
1
vote
1
answer
139
views
Getting error when calling Powershell script Get-AzureRmSqlServerFirewallRules?
I am calling the following script
az login -u <USERNAME> -p <PWD>
az account set --subscription Sub2
$sourceResourceGroup='Source-Networking'
$sourceSqlServerName='SourceSQLServer'
$...
0
votes
1
answer
172
views
| Powershell | For Each Loop a CSV, full of names, into a XML file
So I'm quite a novice when it comes to powershell, I'm trying to make a script that loops through a CSV file and outputs a XML file that follows a schema. More specifically, I'm trying to take each ...
1
vote
1
answer
3k
views
Powershell Test-Path and If statement, executes both if and else statements
I'm doing a few small school assignments, but our teacher is doing a pretty bad job in explaining stuff, so I've basically just been googling watching videos etc.
But I have to make a script that ...
4
votes
2
answers
806
views
Using PowerShell backtick character for snippet execution doesn't work
When I run the backtick (`) command on this snippet:
Get-WmiObject win32_service | Where-Object { $_.pathname -notlike "C:\windows\*" -and $_.startmode -eq "auto" -and $_.startname ...