Skip to main content

All Questions

Tagged with
0 votes
2 answers
186 views

Splitting strings based on regex expression

Is there a quick way I can split a string based on a regex expression match. Using Powershell This string "800G1" should read "800 G1" but when the string is found it just ignores ...
Iain Howard's user avatar
2 votes
1 answer
167 views

Is it possible in PowerShell to split a 4096 character variable into equal 1024 character parts? [duplicate]

I have seen this done in other languages, but I have not been able to achieve this yet in PowerShell. I am attempting to read in a device's HardwareID for importing into Azure. The HardwareID variable ...
Retoxx's user avatar
  • 33
1 vote
2 answers
349 views

Compare against array of regexes in powershell

I'm working on building a whitelist comparison. It works perfectly, but I'd like to add the ability to have strings containing wildcards or regex included in the array representing the whitelist. ...
Tim Brigham's user avatar
1 vote
2 answers
93 views

powershell get content from one file using array of regex and replace content within another file

I know some programing basics but this project is far beyond my knowledge. Any help would be really appreciated, thank you in advance. There are two files with text (see below) and I need to examine ...
fil brinza's user avatar
1 vote
1 answer
149 views

PowerShell array containing integer '0' does not match "^(0|3010)$"

I am trying to process return codes for multiple installers using a -match statement. I would expect the following code to return 'Installer(s) ran successfully' twice - but the -match statement does ...
Minkus's user avatar
  • 480
1 vote
1 answer
788 views

Extract specific object from JSON array as a comma separated string via PowerShell

I'm trying to write a basic JSON interpreter in PowerShell for a scheduled external port scanner which outputs open ports via JSON, but I'm having a lot of trouble getting it to display the data as a ...
lieutenantprivatesprite's user avatar
1 vote
1 answer
1k views

PowerShell Read file line by line, regex each line and store the item in an array

New to PowerShell..I'm trying to read a file line by line and regex the information into 2 arrays so I can do more processing using those arrays later. Each line of my file looks like this, there are ...
DL72's user avatar
  • 127
1 vote
2 answers
552 views

How to construct an array of arrays with Powershell? [duplicate]

To group data, every time there's a "new person" as below, I want to add their info to that temporary array and reset that array to null. Before each "new person" array is set to null, I want to add ...
Thufir's user avatar
  • 8,505
2 votes
1 answer
1k views

Powershell remove any lines from big text file containing any of a large number of strings

We have a large (~100MB) text file. We need to remove any lines that contain certain phrases. I would like to use PowerShell to replace the current method of doing it, which uses windows grep and is a ...
Pink's user avatar
  • 48
4 votes
3 answers
106 views

Newcomer needing help getting the right Regex

I have certificate information from websites in powershell, they usually look like this CN=Google Internet Authority G3, O=Google Trust Services, C=US I need help getting the right regex to only take ...
Virtual Penman's user avatar
1 vote
1 answer
47 views

PowerShell searching matches over 3 CSVs ... slow execution

I have to find matches over 3 CSVs. It is to find out whether users have AccessRights on PublicFolders in Exchange 2016. For ease of use I have already searched and stored all the needed values in 3 ...
Alexander Poettinger's user avatar
1 vote
3 answers
98 views

Bulk regex removals against large array very slow in PowerShell

I am trying to find the quickest / most efficient way to run many regex removals against an array. My $hosts array contains tens of thousands of individual items, in domain format. E.g: test.domain....
mmotti's user avatar
  • 341
0 votes
2 answers
548 views

Parsing a text file line by line and extracting string if it matches

We have a text log file similar to below with many users <user>sandip</user> something <time>4:38 PM</time> anything <elapsed time> 60 mins </elapsed time> We want ...
Sandip Joshi's user avatar
1 vote
2 answers
2k views

How to split ics calendar events in Powershell

I'm trying to write a script to merge two Google calendar ics files and remove duplicate events. Using Powershell I tried the following $cal1 = get-content ".\googlecalendar.ics" $calarr = $cal1 -...
umsrato's user avatar
  • 21
2 votes
4 answers
2k views

Parse RegEx IP matches in Powershell array

I am trying to work out how to parse an array for IP addresses. I have already worked out how to resolve the IP to DNS Hostname so far I have this: Function Get-IP-Hostname { Param([string[]]$...
AK37's user avatar
  • 33

15 30 50 per page