Questions tagged [powershell-ise]
PowerShell-ISE refers to Microsoft Windows PowerShell's Integrated Scripting Environment.
74
questions
0
votes
3
answers
503
views
When changing a password via PowerShell, is there a way to bypass the prompt that asks for the existing password?
Below I have some code that will ask the user for their admin credentials and if they're within that domain, the script proceeds and then resets the password of a user of their choosing. It works......
0
votes
1
answer
60
views
Exercising clean code
I have a script that if kept on the same line, it'll be quite annoying to edit. But at the point at where I want to break line, I get the error when running,
-ApplicationParameter : The term '-...
0
votes
0
answers
92
views
Windows server manager got uninstalled after deactivating windows power shell ISE (Windows server 2016)
After removing Windows Powershell ISE feature, the server manager became unavailable until reenabling/activating Powershell ISE. any help on how to remove it without affecting server manager
0
votes
2
answers
232
views
Need Remote computer to grab local files
so I'm currently working on our Staging server, which has Admin privileges that I do have. So I've tried the Invoke-Command cmdlet and the Enter-PSSession cmdlet and although these still could help, ...
0
votes
1
answer
31
views
Powershell not processing beyond 1 entry in array. How can I make this work?
New to this. I have made the below script to download the newest versions of the applications and install them, but it only ever processes the first entry innosetup[0]
$inno ="https://downloads....
0
votes
1
answer
632
views
How and Where to use Line Break in PS ISE
I have a script that I will post down below, and the console feedback is kind of ugly, which I will also post below the script. I am wondering HOW and WHERE do I put a line break to ensure the console ...
0
votes
1
answer
131
views
Running script on server prevents local copy & paste
I have a powershell script running on a server which performs some copy and paste commands with files.
While the script runs, if I copy something on my local machine it doesnt not copy; the script ...
4
votes
2
answers
2k
views
Excluding a specific folder in PowerShell
I'm pretty new to scripting, as well as to PowerShell. What I'm trying to do is deploy files from one folder (C:\Deployments\QA\QADEP-1504\Processor Handlers\Release) to another folder on a remote ...
2
votes
3
answers
4k
views
Windows PowerShell ISE freezes on launch every time - how do I diagnose?
Every time I launch PowerShell ISE (x64 or x86), I get this:
It is drawn exactly as shown and immediately unresponsive. The black part at the bottom is within the window boundaries.
PowerShell CLI ...
0
votes
0
answers
1k
views
uninstalling the chrome using powershell script
I am trying to uninstall google chrome using powershell script but it shows me a popup to choose uninstall/cancel. How can i supress this by choosing uninstall button?
Set-Location 'path\to\my\chrome' ...
1
vote
1
answer
6k
views
How to check if process is running properly in Powershell?
I'm writing some powershell to check if the Google Drive for Desktop process is running. If it is, I need to stop it and restart it. I'm having trouble understanding how to avoid throwing errors if ...
7
votes
1
answer
16k
views
How to get current path in powershell into a variable
(I don't speak English. Hope you understand.)
Hi, I have a powershell script(.ps1) and it needs to work with the current path(e.g. "C:\Users\user\Desktop"). I don't know how to set it into a ...
1
vote
1
answer
126
views
Regex: Put some tags at the beginning of the line, but only those that are framed in a comment html
I wanna put some tags at the beginning of the line, but only those that are framed in a comment html. For example:
<!-- ARTICOL START -->
<p class="text_obisnuit">I want go home&...
0
votes
3
answers
741
views
Regex: Select and Delete everything that is framed in the comments html tags
I have this html code. And I want to select/delete everything that falls between the comments <!-- ARTICOL START --> and <!-- ARTICOL FINAL --> except all those <p class=..</p> ...
0
votes
1
answer
127
views
Enabled AD Group Members of multiple groups
I'm trying to get only enabled members which are in multiple groups but not sure how to achieve this in the format I want. My current script is as follows.
$GroupList = @('GroupA','GroupB'
)
$...
4
votes
2
answers
5k
views
Difference between Echo and Write-Host in PowerShell ISE
I'm starting to learn (beginner) about PowerShell script. I found that echo and Write-Host both can display output in the console screen, so what is the difference between them? I read this question ...
2
votes
1
answer
256
views
Echo statement is not working inside ForEach-Object loop unless you use break statement. Why and any alternative to fix this?
I was designing my own function which renames the .ps1 file to .psm1 with the same name of .ps1 file.
Example: Add-UdfUser.ps1 will become Add-UdfUser.psm1.
It works completely fine. It changes the ...
2
votes
2
answers
4k
views
Getting error when converting string to formatted datetime in powershell "String was not recognized as a valid DateTime"
I'm retrieving the Media Created column field from file explorer this way:
$mCreated = $shellfolder.GetDetailsOf($shellfile, 208);
And that works fine. It gives me the string "5/7/2017 4:09 ...
0
votes
0
answers
272
views
PowerShell ISE running previously ran script on running new script
PowerShell ISE
I have two scripts : A.ps1 and B.ps1
1> I will run A.ps1 Script. It Ran successfully and Logging logs in local file.
2> On running B.ps1 script. Still executing A.Ps1 script in ...
0
votes
1
answer
960
views
How to run power shell script using different local admin count
In my computer, I have used 2 local administrator accounts which are inbuilt one(Admin1) and newly created one(Admin2). Both accounts are a member of the Administrator group.
I have a PowerShell ...
1
vote
0
answers
2k
views
Powershell persistent history in the ISE
(EDIT 2: now including the output of Get-Module)
In a Powershell prompt I have persistent history across sessions (see this related question).
But when I launch the Powershell ISE, I do not have ...
1
vote
1
answer
486
views
Powershell: Fails calling function when run as batch
I have created a GUI for my script. The user selects from two lists, and then clicks a button to load the programs. In ISE, everything works fine. However, when run from a batch file, (or *ps1 file ...
2
votes
1
answer
7k
views
How to merge multiple excel files and update the merged file's worksheet names as excel files?
Can somebody please help me to resolve this. This is my requirement:
I have few excel files (It will vary) in a folder D:\Script\Test
The name of the files are ExcelA, ExcelB, ExcelC etc
It has ...
0
votes
1
answer
595
views
Use PsExec to run robocopy
Hi I'm currently making a script that copies a directory to another. I'm currently using this:
robocopy $splunkconfig 'C:\Program Files\SplunkUniversalForwarder\etc\apps' /is /it /copyall /mir
But ...
1
vote
1
answer
1k
views
Return a row if a column has a partial or perfect match with CSV in Powershell
Basically, I want to search for a string and return any full or partial matches in a CSV format.
Let's say I have an object $Shoes that looks like:
"Brand","Style","Color","Price"
"Reebok","...
0
votes
1
answer
2k
views
Finding current open file path in PowerShell ISE
I need to sign the scripts I write within ISE to run them. How can I get the path of the current open file in the active tab?
1
vote
2
answers
665
views
Moving folders based on condition
I have many excel files in a single folder like below.
+----------------------+
| 01012019_LOC001.xlsx |
| 01012019_LOC002.xlsx |
| 01012019_LOC003.xlsx |
| 02012019_LOC001.xlsx |
| 02012019_LOC002....
0
votes
1
answer
423
views
sqlcmd hangs when started on powershell Ise
I had sqlcmd - Microsoft command line utility - working on Powershell Ise. After installation of SSMS 17 and newer odbc driver, it stopped working.
When I start it, it just hangs.
It does works on ...
8
votes
5
answers
23k
views
PowerShell ISE - Is there a keyboard shortcut for commenting out lines or multiple lines
In PowerShell ISE I would like to comment out a line or multiple lines at once with a keyboard shortcut like how Sublime Text does this.
Is this possible to add or remove the # shown in the example ...
0
votes
1
answer
1k
views
Pick up 2 file extensions in a directory using FileSystemWatcher
I am looking to pick up only pdf and rtf files but I get a result of "true" when echoing the variable
$watcher = New-Object System.IO.FileSystemWatcher
Write-Host "First line of the script, getting ...
-1
votes
1
answer
43
views
How to add SAMAccount to results?
Stuck on how to add SAMAccounts (AD usernames) to the results, can anyone help?
Get-Mailbox -ResultSize Unlimited | Get-MailboxPermission | where
{$_.user.tostring() -ne "NT AUTHORITY\SELF" -and $_....
1
vote
1
answer
3k
views
How to check if a server has a fixed IP address using Powershell?
for me to check if the server has a fixed IP address at the moment I go through a long process, as described on the pictures below, in order, and that is for windows server 2016.
my question is:
is ...
-1
votes
2
answers
1k
views
Update Registry Key (Change starting day of week in Windows ) via Powershell - Simple and easy not fancy like mentioned below [duplicate]
I am updating a reg key via GPO but it fails to update (Still Dont know why, though looking into it). Is there a way to do it via powershell ? I will include this in logon script.
FYI: HKCU\Control ...
0
votes
1
answer
6k
views
Can we use canonical name to filter Computers?
I ran a command to get Computers in an OU filtering canonical name rather using searchbase. I got error:
“A filter was used that uses constructed attributes”
What's that?
I think it's because ...
1
vote
0
answers
2k
views
Powershell - Cannot run multiple commands in PS ISE
I was writing command to get member group of a computer and was then performing a remove operation and then again displaying the membership of computer but the third line of code to display new ...
1
vote
1
answer
3k
views
How to toggle visibility of console pane or hide it in PowerShell ISE
I've started using PowerShell ISE. It shows two panes at start-up namely script pane and console pane. While writing the PowerShell script I don't want to see the console pane. Console pane is ...
0
votes
1
answer
1k
views
Connecting to remote desktop using Psexec Tool works with Powershell and Cmd but it doesnt work in PowerShell ISE
I use this command psexec \\ip_address -u user_name -p psw cmd
to connect to remote desktop to run commands, it works when you use this in Power shell or command prompt but it doesn't work in Power ...
0
votes
1
answer
2k
views
How do I set Windows PowerShell ISE default theme?
Whenever I change the theme in the PowerShell ISE options on Windows 10 to Light on Light it doesn't keep it when I restart, it goes back to the default Dark on Light. How can I set/force Light on ...
1
vote
2
answers
3k
views
Setting explorer size in windows using the Custom Set-Window Script in Powershell
I'm trying to use the script given in this answer
Setting window size and position in PowerShell 5 and 6
to set the height and size of multiple windows explorer windows. Not the internet explroer.. ...
7
votes
1
answer
5k
views
In Powershell, what is the difference between -Property and -ExpandProperty?
Running the cmdlets, the outputs are slightly different, and I'm just trying to understand the difference between the two cmdlets and why you would use one over the other.
Example:
Get-Date | Select ...
1
vote
1
answer
178
views
How can I store a Powershell variable's value as a string while creating ISE submenus
I can't seem to articulate my issue well enough within the search engines to find the answer I'm looking for, so I turn to the community for help:
I want to populate my Powershell ISE's menu with ...
1
vote
2
answers
1k
views
PowerShell ISE - Unexpected Error
I don't get the autocomplete suggestions anymore in PowerShell. In the shell itself I only get a weird little dot where the suggestion should be and when I hit CTRL - spacebar in the script pane in ...
0
votes
0
answers
501
views
Powershell ISE: Closing a PowerShell Tab does not unlock a dynamically loaded .NET assembly
Please consider the following scenario.
Launch Windows Powershell ISE (64 bit)
Create a new PowerShell Tab
Create a new PS script which loads a custom assembly by invoking
[System.Reflection....
1
vote
1
answer
1k
views
Windows 10 and RDC Manager v2.7 missing cursor PowerShell ISE
In Windows 7 no problems. Last week had to upgrade to Windows 10. Now I my mouse cursor disappears in the PowerShell ISE in Server 2012 R2. I tried [Console]::CursorSize = 25 from another post, but ...
3
votes
1
answer
393
views
Change PowerShell ISE Keyboard Shortcuts
Is it possible with a registry hack or another mechanism to change the default shortcuts in PowerShell ISE? I'd like to modify the debugging shortcuts to be keys that I use in other applications for ...
1
vote
1
answer
305
views
How to Keep ISEModuleBrowserAddon from Disappearing in Powershell ISE?
Every time I close and re-start Powershell ISE the Module Browser disappears and I have to re-import the module. Is this just poor intended behavior? Sort of a nuisance to have to Import-Module ...
0
votes
0
answers
5k
views
PowerShell ISE - Wrapped Find/Replace
The find/replace of Powershell ISE doesn't wrap the search (go back to top of file after end of file) (like seen in Notepad++). Is there a setting to toggle this? Seems to be the first editor I've ...
0
votes
0
answers
701
views
Is my PowerShell execution environment subtly corrupted?
I don't expect an answer, but I'm hoping for a direction.
Sometimes, PowerShell ISE seems to just act, well, weird. The weirdness seems to come out of nowhere. I haven't found a way to reproduce the ...
0
votes
1
answer
8k
views
create a calculator with Powershell GUI
So hello guys
Im trying to creat a calculator. So far I have the GUI finished. But i Need some help with the backgroundfunctions. Example: i type on the buttons 5+6. Now when i press "=" it should set ...
0
votes
1
answer
529
views
Copy content of Buttons into the textbox?
So I am trying to program a simple calculator. I have a very simple question. How can I copy the content of a Button into the textbox?
z.B copy Button1 with the content 1 into my TextBox
This is my ...