922 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
2
votes
3
answers
201
views
How to add properties to a $Form = [system.windows.forms.form]@{} created object, after creation
Say I create a form like this $Form = [system.windows.forms.form]@{}.
Then later I want to add to this form, do I have to do the following:
$Form.Property1 =
$Form.Property2 =
$Form.Property3 =
Or ...
0
votes
0
answers
30
views
Cannot comprehend why my VS dev console chokes, but regular powershell 7 works, is this caused by Powershell 5's arg handling? [duplicate]
I have this snippet in a Powershell script, I can run the script on PSVersion 7.4.7 without error or problem, the git option gets set properly.
$cmd = '"' + $mergeTool + '&...
1
vote
1
answer
106
views
Powershell 5 - Multicolored text on the same line, logged on text file on the same line
I'm currently running a ps1 script in Powershell 5, where I need two things to happen at the same time:
display (on the console) a text with different colors on the same line;
save (log) everything ...
0
votes
1
answer
22
views
How to get count of PSObject when there is only one object left
I have the below code which produces the PSObject:
$Installs = foreach($CVAFile in $CVAFiles)
{
$CVAFileContents = get-content $($CVAFile).fullname -raw
$CVAFileContents -match '(?s).*?\[General\]...
0
votes
1
answer
25
views
Powershell module class usage within a class
I have a script like this, in a classes.psm1 file:
class A {
A([string] s) { }
}
class B : A {
B([string] s) : base($s)
}
Then I try to import it in a .ps file:
using module classes.psm1
...
1
vote
2
answers
129
views
Rename files sequentially and if file already exists (name conflict) then just increment the iterator to give the file a fresh name
I have this code to mass rename all the .mkv & .mp4 files in the specific directory of my choosing:
$i = 0; Get-ChildItem "$env:Userprofile\Videos\Movie_Best_Clips" -Filter "vlc-...
0
votes
1
answer
61
views
Get trimmed down text from Powershell
I am scraping version information from a website. I am able to get the information, but unable to get it without formatting. Currently targeting the DIV tag with Id j_idt19. Is there a way to get the ...
0
votes
1
answer
170
views
Powershell class can't call its own methods when invoked from runspace
I'm facing a weird bug where my custom class can't seem to be able to call its own functions (static or not) when it is invoked from a runspace (so, when one of its methods is called from a runspace, ...
1
vote
1
answer
849
views
PowerShell export data to CSV in proper format
I get PSDrive information of my computer and put them into table format.
Get-PSDrive -Name C, D |
Select-Object -Property Name,
@{Name="Total (GB)"; Expression={($_.Used + $_.Free) / 1gb}},...
2
votes
1
answer
78
views
Make the Powershell script apply to the subfolders and make the output behave correctly
This PowerShell script processes CSV files and their corresponding "_Inglese" files, updating translations in the CSVs based on the contents of the "_Inglese" files. It retrieves ...
2
votes
1
answer
181
views
Modify the output of this script so that it is read as BOM-less UTF-8
I have several .csv files in a folder with the second column empty and I would like to fill it with the data present in as many csv files with the same name+column3.
Example:
firstfile.csv
header1,...
2
votes
1
answer
96
views
How can I change middle item of path in PowerShell?
I would like to invoke ImageMagick to compare images by SSIM. The images are in following directory structure:
+ root
|
+- FooBar
| |
| +- 2023-10
| | \- *.png
| \- 2023-11
| \- ...
0
votes
1
answer
175
views
Powershell Rename Long and Complex Video filenames
I just got recent released series called "THE FALL OF THE HOUSE OF USHER". I want to rename it's episode-video files to much easily readable all capitals and dots in filename replaced to ...
0
votes
1
answer
661
views
How to add another action when creating scheduled task in Powershell
There is a main.ps1 file that is uploaded to devices so it can create all the necessary tasks they need to run when distributed. Within this main.ps1 file I have added code to create a new task, but ...
0
votes
1
answer
166
views
Powershell Export-CSV Tab Delimiter Output issue
Below is the Input CSV file which when after doing a sort and doing an export-csv , the format of the out does not looks good when opened.
$FileLogdate = (Get-Date -f yyyy-MM-dd_HH-mm-ss)
# Inputfile
...