Questions tagged [powershell]
Windows PowerShell is a command line shell and scripting language for Windows that supersedes the CMD.exe shell and batch language. PowerShell is also an automation engine for Windows that provides functionality similar to Windows Script Host and VBScript.
5,769
questions
4
votes
3
answers
6k
views
Downloading Google Chrome using Powershell
Is it possible to download the latest version of Google Chrome using Powershell. I'm an IT Admin looking at putting a script together for our field techs. Since upgrading our client machines to ...
2
votes
1
answer
871
views
Get-WindowsUpdate does not update the Windows Update GUI
Having an issue that I cannot seem to find any information on.
I'm using the Get-WindowsUpdate and Get-WUList modules in PowerShell to attempt to download and install Windows updates.
$...
1
vote
0
answers
134
views
Unattended install of gui-installer over intune
Right now, I'm packaging some piece of software intune for which the developers didn't intend a silent-install-mode. Without a silent-install the manual rollout of this software would be very tiresome....
0
votes
0
answers
63
views
Cmd uninstall string not working
I have to remove a software from several computers with remotely. Uninstall-Package and wmic commands seems working but not working, the software still there.
I thought I can uninstall with uninstall ...
0
votes
0
answers
514
views
How to silently uninstall Visio remotely
I have to remove Microsoft Visio silentlyy from a lot computer. I tried Uninstall-Package and wmic commands, via PsExec, seems working but not uninstalling, still there. It is for Visio 2016 and Visio ...
3
votes
0
answers
120
views
How to log the activities only of a specific rule of Windows Firewall from PowerShell Or Other alternatives
I want to monitor network activities only of a specific rule in the Windows firewall.
Because the firewall makes huge logs of all the enabled rules which makes it hard to analyze traffic on 1 specific ...
1
vote
1
answer
475
views
Windows ssh as administrator not working with keys not named `id_rsa`
I'm attempting to pull down a GitHub repo in Windows 11 using PowerShell. My machine is configured with OpenSSH Client in Windows.
I verified:
ssh-agent is running
same key is registered with ssh-...
1
vote
1
answer
517
views
how to convert udf file to docx via command line
How can I convert a udf file to docx using the command line? Is there a program that does this? This command line can be PowerShell or VBScript.
Here is the file:
Here is a link to the editor:
https:/...
0
votes
0
answers
45
views
Check if Logitech K400+ is turned on or off / Logitech K400+ Power Change Event
I'd like to run a script when I turn my Logitech K400+ on or off.
I tried to detect the status of the device using Get-WmiObject win32_keyboard and Get-WmiObject win32_PointingDevice, however, the ...
3
votes
0
answers
938
views
PowerShell - Cannot uninstall the Microsoft.HEIFImageExtension on several Win10 systems
I have a PowerShell command line to uninstall the HEIF image extension component provided by default on Win10/Win11 OS. This command is the following:
get-appxpackage Microsoft.HEIFImageExtension -...
2
votes
2
answers
154
views
Is it possible to write a script to uncheck the turn off all unnecessary animations (when possible) checkbox
Whenever I use remote desktop to get into my computer at work, I always have to go to the:
control panel -> ease of access center -> make the computer easier to see
…and I need to uncheck the ...
0
votes
0
answers
35
views
Copy key to server in powershell? [duplicate]
I want to copy an id_rsa.pub key to a server by SSH. This link mentions how to do just that but it's not working when I enter in the correct credentials for the SSH login ?
1
vote
1
answer
2k
views
How to output verbose logging from powershell that is being called by an Ansible playbook
I have an ansible playbook, similar to this:
- name: Run Powershell script with Parameters.
win_shell: MyPS.ps1 -Param1 "{{ Param1 }}"
and within the Powershell script I ...
1
vote
2
answers
677
views
SSH from PowerShell/CMD to Linux w/out dark blue text
So currently my shell looks something like this when I SSH into my Debian server:
I mostly use PowerShell as the client and customize the background & text colors to match system theme. Command ...
3
votes
2
answers
539
views
How to read a string from a cmd output and return the value in a batch script?
My Windows server is connected to a remote office network through two default gateways.
Default Gateways
172.20.0.1 Primary
172.20.0.254 Secondary
// Secondary connected with
// 4G SIM card VPN
...
0
votes
1
answer
108
views
Windows 10 - Recover missing content of large folder
I have a large pictures folder, most of then "bulk" downloaded using Hitomi Downloader, DownThemAll and similar. Yesterdary I ran a Powershell command I always use to rename the last ...
0
votes
0
answers
372
views
How do I select elements that come from an Invoke-WebRequest
I have the following request:
$request = Invoke-WebRequest -Uri "https://........" `
$requestEncode = $request.ParsedHtml.documentElement.innerHtml
$requestEncode
which gives me back:
// ...
2
votes
1
answer
130
views
How do I keep programmatic shortcuts visible in Recent Items?
Using this answer, I can create shortcuts (.lnk files) for various executables and folders.
When I use the Recent Items directory (C:\Users\%USERNAME%\AppData\Roaming\Microsoft\Windows\Recent) in the ...
2
votes
1
answer
319
views
How cmd get arguments list
I have a file a.cmd. Path to the file is C:\Program Files\a\a.cmd and C:\Program Files\a is in PATH environment variable.
When I invoke a.cmd from PowerShell (v. 7.2) I see that a process with the ...
0
votes
0
answers
115
views
How can I modify this Powershell script to combine two files
I'm looking for help modifying the following PowerShell script, so that it combines two files from two different folders - both with the same filenames but different extensions (one .txt and one .dat) ...
1
vote
1
answer
383
views
How do I change the background color for folders in PowerShell when invoking the "ls" command from WSL Interop?
I've installed the WslInterop module and exposed several commands from WSL2.
I'm using Import-WslCommand "apt", "cat", "awk", "nano", "find", "...
0
votes
0
answers
1k
views
Execute a Batch and Powershell Script on a Remote File Server
I'm telling you that I'm trying to figure out how to run a PowerShell script without having it stored on the computer. simply running it with some jse script and let the script know where the file is ...
1
vote
0
answers
494
views
Change BIOS Settings (Enable Secure Boot) on Toshiba and Dynabook with Powershell
I am trying to write a Powershell script to enable Secure Boot on a Dynabook Tecra BIOS, I have written another two for HP and Lenovo and they are working fine. The script that is listed in the ...
0
votes
0
answers
352
views
Write powershell output to file from within batch file
Trying to write powershell output to file from within batch file.
powershell -executionpolicy bypass -command "(get-date).addminutes(1).tostring('HH:mm')|out-file '$env:temp\newtime.txt'"
...
2
votes
1
answer
1k
views
PowerShell es-es Language Installation: ErrorCode -2147418113
I'm trying to install language with PowerShell run as admin on another computer but it fails with the ErrorCode: -2147418113 :
PS C:\WINDOWS\system32> Install-Language es-es
Install-Language : ...
0
votes
1
answer
657
views
Find an SSL certificate with Powershell that is NOT expired
I am struggling with the logic behind finding a certificate that is not expired in Powershell. I have the potential to have multiple certs with the same CN installed, most of them expired, with at ...
1
vote
0
answers
61
views
How to monitor and move files to different directories one by one and in sequence on Windows?
How to monitor when files are created and then move them to different directories one by one and in sequence on Windows?
For example, I have files in C:\Temp
File names are random like File545.tmp ...
0
votes
0
answers
2k
views
How to install language packs for all existing and new users
I have to install 5 languages in an already Windows 10 installation :
"fr-FR","ro-RO","es-ES","it-IT","en-GB"
I have tried :
$languagePacks = @("...
1
vote
1
answer
2k
views
How to replace the values/text in XML file using Powershell
I have the following content in a XML file. I'm trying to update the XML file using powershell script
<?xml version="1.0" encoding="utf-8"?>
<Topology>
<Core>
...
0
votes
1
answer
226
views
Deploy encrypted password on Windows 10 without key
I've previously been using mkpasswd to encrypt a password on Linux, and piping it to chpasswd to set the password of a new user.
I run mkpasswd standalone on a machine:
$ printf "s£cr3t" | ...
2
votes
1
answer
335
views
I accidentally activated this history search feature in powershell core. What is it called?
I have a rather unusual request - I accidentally activated this feature with my laptop keyboard:
It shows all previous commands that match my command prompt. It is very useful, but it appears to be ...
0
votes
1
answer
5k
views
How to pass the credentials along with username and password in powershell command
I'm trying to enter a remote session using powershell. I have created the following command, however it asks for a password to enter it manually and then it connects. I was looking with out a prompt ...
2
votes
0
answers
46
views
PowerShell output is saying no
I wrote this PowerShell script to read two big text file based on the following model:
ID "Text", the script read both text file and is supposed to compare them and tell me if the line exist ...
1
vote
0
answers
63
views
Launch docker container from power shell fail, unexpected behavior?
I have created the following script in powershell for two objectives:
read from an .env file the setup of the local urls of my development environment and deploy them to the Windows hosts file.
take ...
0
votes
4
answers
730
views
How do we search for files which contain a specific word and end in a specific file-type suffix?
How do we use Microsoft Windows PowerShell and Regular Expressions (Regex) in order to find all of the pictures (image files) on a computer such that the file name contains the word "dog".
...
1
vote
0
answers
343
views
WSL not working after moving Ubuntu from C: to D:
I needed to move some files from my SSD (C:) to my HDD (D:), so I used the move option on the Ubuntu app listed in Settings>Apps>Installed Apps. However, this stopped WSL from recognizing that I ...
-1
votes
1
answer
189
views
How to read the contents of a file using powershell script
I have a directory that has multiple log files and I would like to generate the latest log file based on time and read the contents of that latest log file.
I have written the following, which gives ...
0
votes
0
answers
53
views
Issues communicating PoKeys57CNC and Mach4 running on Windows 11 Home PC in Custom Shel Kiosk Mode
Some background Information
I am using a Windows 11 Home PC to control a plasma cutting machine. The windows 11 machine uses Mach4 as the interface for controlling the plasma cutter and a PoKeys57CNC ...
1
vote
1
answer
163
views
get-culture returns wrong results when run in remote session
I want to check the number decimal separator on multiple machines use powershell. If I run get-culture in local powershell the result is correct. It will return English (UK) and correct number format, ...
1
vote
1
answer
366
views
Parsing repeated Logon and Logoff events for users on Domain Controller to produce single logon and logoff in a report
Task
I have a domain controller running on Windows Server 2016. The Event Viewer shows events with ID's 4624 and 4634 every time a user logs on or off with a domain user account. (...maybe, the events ...
0
votes
0
answers
23
views
Does the term "virtual desktop" mean separate things on Windows 10 compared to Azure?
I'm trying to learn how to programmatically control the Windows 10 Virtual Deskop. I've found this library but it's taking some time to find documentation/examples of my usecase*. Most of what I find ...
0
votes
1
answer
42
views
"hostname is too long" error messages in PowerShell when running a foreach loop
$IPadd = get-content LRSHost.txt
foreach ($ip in $IPadd) {
[system.net.dns]::gethostentry("$IPAdd")
}
When running this I get this error:
the size of hostname is too long. it cannot be ...
0
votes
0
answers
10
views
PowerShell Set-ItemProperty LastWriteTime incorrect locale [duplicate]
I am running a powershell script:
sp -Path "c:\myfile.txt" -Name LastWriteTime 01/12/2020
It works, but it interprets the date "01/12/2020" as 12th of January 2020, eg MM/DD/YYYY, ...
0
votes
0
answers
1k
views
Use Powershell to connect to LDAP
Is it possible to use Powershell to perform the following tasks?
My authenticate with my DN and password AND...
Search for a member of a group by email and show if it exists
List all members of a ...
0
votes
2
answers
118
views
MalwareBytes Anti-Exploit occasionally triggering on a CMD/Powershell get softwarelicensing something from 55c92734-d682-4d71-983e-d6ec3f16059f
C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe (([WMISEARCHER]'SELECT ID FROM SoftwareLicensingProduct WHERE ApplicationID=''...
0
votes
3
answers
2k
views
Best method for setting permanent aliases in powershell?
When I install something like ffmpeg with winget, it sets permanent aliases for ffmpeg, ffplay, & ffprobe.
winget install gyan.ffmpeg
It doesn't look like it's adding anything to my path ...
0
votes
1
answer
304
views
Windows AppLocker isnt blocking Apps anymore?
Atm i am testing about to create rules with scripts, but that isnt the problem.. I allow aus path "*" and e.g i want to block Google Chrome, i use a exception for this usecase. But since ...
0
votes
0
answers
110
views
Friendly name set using set-physicaldisk is reset after reboot
I've set a scsi disk's friendly name using set-physicaldisk however I've found that rebooting the machine causes the friendly name to be removed and reset to the original value.
Is there a way of ...
0
votes
0
answers
195
views
How to update a Azure resource tag value when there is a hyphen in its name?
I have written a PowerShell script to update the Tag values for specific tag names, now for all the tag names that do not have special characters in them (eg. department) this works just fine, but I ...
0
votes
1
answer
1k
views
List Windows Printer 'Printing Defaults' Configuration
How can I programmatically retrieve and display property values from a printer's Printing Defaults settings?
I can successfully retrieve property values from a printer's Preferences using PowerShell, ...