Skip to main content

Questions tagged [powershell-5.0]

For questions specific to Powershell Version 5

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

Issues with deleting files from System 32 using a PowerShell script

this is the script I'm working with # Define the top-level folder and the list of files $topFolder = "C:\Windows\System32" # Update to System32 directory $files = @( "mstsc.exe&...
garrett aguiar's user avatar
1 vote
1 answer
68 views

Is this ResetWindowsSearchBox.ps1 the same as a Delete and Rebuild Index in Indexing Options?

We have some windows.db files on a few machines that have grown to massive sizes in Windows 11; and I was wondering how to use Powershell 5 to clean these up. I am aware of the Control Panel’s ...
leeand00's user avatar
  • 22.9k
0 votes
1 answer
254 views

Powershell Crashes upon launch

Long-time issue, haven't gotten anywhere. Windows Server 2019 Datacenter (1809 - OS Build 17763.5576), Enterprise environment with 14 physical servers, all same OS. When I launch powershell in this ...
MattyBernstein's user avatar
0 votes
0 answers
426 views

PowerShell: Diagnose timeout vs. connection refused on TCP port with Test-NetConnection

I frequently need to diagnose network connectivity issues and I'm currently using Test-NetConnection in PowerShell (Version 5.1). The output tells me if a port is reachable. In case it's not, I would ...
everdream's user avatar
1 vote
0 answers
32 views

Auto Load PowerShell Modules (PWSH) To Windows PowerShell [duplicate]

Below List of Modules was installed on PowerShell 7 (a.k.a PWSH) in my PC: AzureAD ManageBootStick PoshFunctions PowerShellAI PowerShellAI.Functions PowerShellAIAssistant PSWriteColor SMBIOS SysInfo ...
Mr.Key7's user avatar
  • 887
2 votes
1 answer
2k 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. $...
RussellLMiller's user avatar
0 votes
1 answer
55 views

Recalling system info in PS

I'm sure this is an easy one for the community, but it's got me puzzeled. If I create a var in PS, say "$s" then assign "systeminfo /s {hostname}" to the var ($s = systeminfo /s {...
Dale's user avatar
  • 43
1 vote
1 answer
984 views

PowerShell 5.1 console: How do I get better default error handling?

In powershell 5.1, the default error response looks like this: Aug01 14:26:01 C:\> throw [Collections.Generic.KeyNotFoundException]::new('example') example At line:1 char:1 + throw [Collections....
Pxtl's user avatar
  • 111
1 vote
1 answer
227 views

Output-Grid via PowerShell for all Inbound Windows Defender Firewall Rules

I have a PowerShell script, that works but what I'm having problems with is getting an output grid like an excel sheet. Here is the code: Get-NetFirewallRule | Where-Object {($_.Profiles -band [...
zerokool000's user avatar
0 votes
4 answers
290 views

power shell command not returning System model

I have the following power shell cmd and I would like to get it to return the model # of the PC it is run on. I am not a programmer, I am simply trying to earn enough power shell to make my work life ...
user1800001's user avatar
1 vote
1 answer
1k views

How to add lines above and below a certain line in Powershell based on regex pattern?

03,201779,,01354,73923309,,,TEST2,7962753,,,0343,5087632,,/#end of line 04,399,777873,,,,text234,,,,/ 33,TEST1,,,0343,,93493,,,343,,,,TEST3,,,,,,/ 37,TEST37,text 49,24605597,6,343,343,343,,,3434,,,/ ...
coder234's user avatar
3 votes
1 answer
154 views

Are Classes defined through P/Invoke not allowed to be executed remotely?

To get it out the way: I understand there are different ways to go about this such as Get-ChildItem. So, I have a custom class I'm defining to get rid of some of the overhead PowerShell cmdlets have, ...
Abraham Zinala's user avatar
0 votes
1 answer
1k views

How to stop cookie prompt while using Invoke-WebRequest in PowerShell

I have a script that uses Invoke-WebRequest. It has worked fine until yesterday when it pauses for a prompt to accept cookies in a window button. $webpage = Invoke-WebRequest -SessionVariable session ...
LouF's user avatar
  • 71
4 votes
1 answer
413 views

Don't want to display WARNING: ACTIONS REQUIRED: while running powershell script

I have written bitlocker code to backup key after old key has been shared with user. My requirement is that don't want to display WARNING: ACTIONS REQUIRED: while running script $BLV = Get-...
Suraj Kumar's user avatar
1 vote
1 answer
449 views

validate particular column and its value using powershell

Validate Status Column using powershell. If any status column contain Not-compliant then overall status column needs to be displayed not-compliant. Attached data for your reference. Trying below code ...
Suraj Kumar's user avatar
0 votes
1 answer
446 views

Export data to excel by creating instance of the Excel.Application object in PowerShell

Currently i'm using ImportExcel module to fetch data from multiple csv file and export in single excel file. But due to network restriction from this month I am not able to install importexcel module. ...
Suraj Kumar's user avatar
1 vote
1 answer
784 views

Copy files and only the parent folder the file resides

Copying files but not all the folders, just the one parent/relative folder in which contains the files. Folder and Files structure: ExcelData (Folder) a. File1.xlsx b. File2.xlsx c. File3.xlsx d. ...
Suraj Kumar's user avatar
1 vote
1 answer
1k views

Validating IPv6 checked or unchecked in Network Adapter Properties

My Requirement is to uncheck IPv6 if it is checked or if unchecked then display already unchecked. I tried below code but it's not giving any output nor any error. $IPv6 = Get-NetAdapterBinding | ...
Suraj Kumar's user avatar
2 votes
1 answer
2k views

Powershell script to capture Screenshot

Don't want to use third party tool and module. $ie = New-Object -ComObject InternetExplorer.Application $ie.Visible = $true $ie.Navigate("https://www.google.com") $ie.FullScreen = $true ...
Suraj Kumar's user avatar
2 votes
1 answer
3k views

Capture batch output and save it in TXT File as log

I'm running powershell script with batch file. My requirement is:- display the output in batch cmd and at the same time save output in TXT file. Note, as of now output getting saved in txt file but ...
Suraj Kumar's user avatar
0 votes
1 answer
118 views

Exception calling "CopyFolder" with "4" argument(s): "The 'destUrl' argument is invalid."

I'm trying to copy local drive folder to targeted folder in online one drive but getting above error. Below is the code tried: - #Load SharePoint CSOM Assemblies Add-Type -Path "C:\Program Files\...
Suraj Kumar's user avatar
0 votes
1 answer
206 views

Run-SCCMClientAction : Connecting to remote server DD4 failed with the following error message

I am running below script on my system to perform all sccm client actions trigger and getting below error. Run-SCCMClientAction : Connecting to remote server DD4 failed with the following error ...
Suraj's user avatar
  • 25
1 vote
1 answer
946 views

Export-CSV column/row value as filename

I've got a bunch of csv files that each look like this: DD-L-1_test.jaun.Csv Parameter, Version, Status OS, 21H2, Compliant Chrome, 107.1.1, Compliant DD-L-2_test.smith.Csv Parameter, Version, Status ...
Suraj's user avatar
  • 25
1 vote
1 answer
515 views

The property 'AcceptButton' cannot be found on this object. Verify that the property exists and can be set

Want to store selected value in combobox in a variable $x, $y and $z but getting below error. The property 'AcceptButton' cannot be found on this object. Verify that the property exists and can be set....
Suraj's user avatar
  • 25
0 votes
1 answer
656 views

Form with Input Window, where a mechanism shall check if data has been entered

I need it to not close when user press enter or exit so that it mandate for user to make entry for all three box. I am new to powershell so I might be sounding akward but I can't find a good solution ...
Sagar Mahto's user avatar
0 votes
1 answer
2k views

Powershell operation with negative numbers

I did a search but only found answers related to excel. Objective : Calculate the difference between the original audio LUFS values and the user defined LUFS value. Both values are negative and I use ...
Clamarc's user avatar
  • 663
0 votes
1 answer
187 views

Command to eliminate blank lines in text file changes special characters

The command to eliminates the blank lines correctly, but it is changing the special characters in the text file. Command: $linblk = [System.IO.File]::ReadAllText("C:\Users\$env:username\Desktop\...
Clamarc's user avatar
  • 663
0 votes
1 answer
7k views

Remove the first three lines in a text file

The script generates a list of Musics that will have their LUFS values normalized, however, first I need to eliminate the header from this list. The header contains three lines: The first line is ...
Clamarc's user avatar
  • 663
1 vote
1 answer
1k views

Powershell commands not working correctly via batch file

The script receives a parameter sent by the batch file, reads a Music Logs file and generates a list with a header and two columns containing the Music name and the LUFS value of each music, according ...
Clamarc's user avatar
  • 663
0 votes
0 answers
144 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
Mohamed Hesham's user avatar
4 votes
1 answer
32k views

Run powershell script, as administrator, via batch file with parameter passing

When I run the script, without an administrator, via batch file it passes the parameter, but when I run the script, as an administrator, it does not pass the parameter. I tried the command from the ...
Clamarc's user avatar
  • 663
0 votes
1 answer
551 views

Remove spaces after file extensions in txt file

I need to remove from my List.txt, everything after the file extension, keeping the extension. I tried unsuccessfully to use the commands in the links: how-to-use-powershell-to-remove-space-from-the-...
Clamarc's user avatar
  • 663
1 vote
1 answer
1k views

Delete files in a folder based on not being in a List.txt

Objective: Delete audio files in a folder that are not listed in the List.txt file Reading the List.txt to compare with the files in the audio folder and deleting the files that are not listed in the ...
Clamarc's user avatar
  • 663
0 votes
1 answer
18 views

Column in custom report disappears

Script Purpose: Read audio files and create a Custom report with the name of the songs and the LUFS value of each one. Problem: When a song name is too long, the LUFS Value column disappears from the ...
Clamarc's user avatar
  • 663
0 votes
1 answer
176 views

Change names within a text file

I have mixed music projects, where the software generates a txt file list of the songs in each project. The problem is that the list is generated with only the first 36 characters of the name of each ...
Clamarc's user avatar
  • 663
0 votes
1 answer
217 views

Duplicate Output Windows Updates Information

The script generates the information of the updates made in my Windows. When the final Get-WuaHistory command is executed, records appear duplicated. I was not successful with the information in the ...
Clamarc's user avatar
  • 663
0 votes
1 answer
53 views

Search a file on all volumes in the computer

I'm trying to search for a file on all volumes on my computer I was not successful with the answer from this link: get-childitem-with-multiple-paths-via-variable I tried: $Location = 'c:\*', 'd:\*', '...
Clamarc's user avatar
  • 663
1 vote
1 answer
794 views

Command to delete blank lines in txt file doesn't work with variable in file path

Command to delete blank lines in List.txt file, doesn't work when I use variable $env:username. Works: Using CMG username in file path. $linblk = [System.IO.File]::ReadAllText('C:\Users\CMG\Desktop\...
Clamarc's user avatar
  • 663
1 vote
1 answer
61 views

Generate txt report of files copied between two folders

I have a script that copies audio files from one folder to another. Script: $tot = 0 $files = 'C:\Users\CMG\Desktop\List.txt' $location = 'C:\Users\CMG\Desktop\Select Dance\' $destination = 'C:\Users\...
Clamarc's user avatar
  • 663
1 vote
1 answer
898 views

Change brackets to parentheses in filename

I need to recursively change the square brackets in the names of audio files to parentheses within multiple folders. Original name: Gonna Get Along Without You Now [Strelka Sounds Edit].mp3 I tried: ...
Clamarc's user avatar
  • 663
1 vote
1 answer
745 views

Copy audio files from multiple subfolders to another folder using List.txt file

My Powershell version is 5.1.19041.1645 I want to copy audio files from several folders to another folder using the txt files where the song names in the List.txt file have a different structure than ...
Clamarc's user avatar
  • 663
0 votes
0 answers
2k views

Find what port number is in use by a service

So I'm trying to take a windows service on one of our servers, "SC - ATM-Encryption" and find out what port it is using. All answers I've seen close to what I'm asking have me doing: netstat ...
Zero596's user avatar
  • 83
0 votes
1 answer
143 views

Power shell script for Monitoring C-Drive

# find the path to the desktop folder: $desktop = [Environment]::GetFolderPath('Desktop') #specify the path to the folder you want to monitor: $Path = $desktop # specify which files you want to ...
user1666054's user avatar
0 votes
0 answers
1k views

How to set the local user account photo with PowerShell?

I want to set the local account photo (the image that shows up in the start menu and above the password prompt when logging in) using PowerShell and an image saved in a certain location. the same as ...
Kennycampbell1's user avatar
0 votes
0 answers
2k 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' ...
ven's user avatar
  • 1
0 votes
1 answer
8k views

Get-AdGroupMember for multiple groups

How do I check if the mentioned security groups exists or not? I would also want the exported .csv to mention 'No members' instead of skipping it. Also, how do I refine below script? And I would like ...
sk noel's user avatar
  • 13
0 votes
1 answer
194 views

What is the hierarchy of login activities user startup scripts, group policies, etc. - Windows 10

Trying to understand what is the hierarchy of login/startup scripts that trigger when a user logs in to Windows 10 and if this is impacting a local user command script in the startup from taking ...
James's user avatar
  • 1
0 votes
0 answers
2k views

How to compare two Excel .xlsx files in PowerShell and output differences in another file

I have used the below code to compare the two files excel1 and excel2 and write the difference out to another file, but the output format is way different than expected. Clear-Host $File1 = Get-...
chandu's user avatar
  • 43
2 votes
0 answers
2k views

Get user profile size?

Wait... before you guys come at me about this being asked before, I assure you it's a bit different. I know how to recurse through directories and measure the sum of each container, to include ...
Abraham Zinala's user avatar
0 votes
1 answer
385 views

PowerShell Programming: Traverse folders and subfolders and apply pdftotext. I/O Error

I have correctly written the following PowerShell command to traverse every folder and subfolder of a directory and display the contents of each such folders: Get-ChildItem -Path "C:\whiskey\...
Anthony's user avatar
  • 153