Category "powershell"

How to glob files into folders depending on their prefix

I have 4000 fish picture files, named as follows: acanthistius_cinctus_1 acanthistius_cinctus_2 acanthopagrus_latus_1 acanthopagrus_latus_2 ... There are 468 s

PowerShell output returns more fields than selected

I've been learning PowerShell over the past month and often times I've found through select statements or -properties iirc, that I get additional data that I do

Why do I get a 'cannot call a method on a null-valued expression' error?

I want to send an email using powershell and it's working perfectly but when I try adding attachment its giving me an error. This is the code $SMTPClient.Send($

Set-ExecutionPolicy unrestricted permission denied

I am trying to set the execution policy to Unrestricted, but I'm getting the following error: PS> Set-ExecutionPolicy Unrestricted Execution Policy Change Th

Scanning log file using ForEach-Object and replacing text is taking a very long time

I have a Powershell script that scans log files and replaces text when a match is found. The list is currently 500 lines, and I plan to double/triple this. the

SQL Server backup using powershell in Task scheduler

I am using PowerShell to backup a SQL Server database and use Windows task scheduler to schedule the script Test Run the script manually, it works. Both SQL Ser

How to fix "Powershell needs Windows management system 4.0'

I want to know How i install Powershell in my win 10 pc because it dont came installed in it Please help me. I will be very thankful to you

Powershell IP address range

I need to help with my code which is write in Powershell. Program should generate IP addresses in range. For example from 10.4.254.250 to 10.4.255.255. When I h

PowerShell Copy All Files in Folders and Sub=Folders Not older than 300 minutes

I am trying to copy all files in folders and sub-folders not older than 300 minutes, but the code I got working only copies the files in the main folder, it doe

How to filter excel file using three or more criteria and copy the filtered data to another sheet using powershell

I have a excel table as below: excel data I want to filter this file based on three criteria i.e. $criteria = "Rice","Vegetables","Butter" and copy the filtered

Reuse 2 functions in Start-ThreadJob

Assuming Get-Foo and Get-Foo2 and Deploy-Jobs are 3 functions that are part of a very large module. I would like to use Get-Foo and Get-Foo2 in Deploy-Jobs's S

Compress files with same name in powershell

I have a folder with more than 1000 file extensions. This is a sample of my files. AFG.cpg AFG.dbf AFG.prj AFG.sbn AFG.sbx AFG. shp AFG.shx AFG.cpg AGO.dbf AGO.

Export HANA SQL query or table in CSV

I use a HANA 2.0 database. I want to export a table or a sql query from the database to an external client as fast as possible and using a command line (i'm on

How do I connect the commands

So, this is my first script ever and I'm not an programmer. Infact, im an 15 year old student, so dont expect much from me, but I need to write a script to crea

Run new instance of CMD in PowerShell without a long string of text

So i was wondering if there was a way to remove all of the "&" when you're running an instance of cmd with arguments through PowerShell For example: start-p

Copy the file with folder structure from Linux to Windows using WinSCP and delete file which ever is copied and keep the folder

PowerShell or WinSCP – need to download the file and folder structure and delete the file which ever is copied and delete the file but not folder structur

Azure AD Updating Bulk users from CSV

I am new to this so please apologise if I missed some information. I have the following situation: I have a employee list in CSV and I need to update existing u

How to apply Excel Table Style using Powershell

I'm thinking about writing script that convert my existing CSV file to XLSX file so I been following this post https://code.adonline.id.au/csv-to-xlsx-powershel

Selection of only one user from list

I have this script that I need to use to retrieve the data of a particular user "ADTuser" from a list of servers the script works well, but the output file wit

Newbie powershell argument issues

I made powershell script that [1] accepts 2 arguments (aka parameters), [2] changes a file's modified date & time, and [3] writes something to host. The fo