All Questions
140 questions
0
votes
0
answers
32
views
combine variable array of properties into a comma separated list powershell [duplicate]
I have a powershell command that pulls a list of devices with PRT in the name to a variable & am then trying to format the list in an easy to read output
$PrinterList = @(Get-WmiObject ...
0
votes
1
answer
68
views
Powershell array objects type being changed to string after using .Replace(), unable to compare to another array, which also claims to contain strings
I am currently working with Exchange Online and Graph to update my company's distribution groups.
The issue I'm encountering is when dealing with external users in my environment. When I am initially ...
1
vote
1
answer
45
views
Powershell split every string in an array
So, I have no seen anything remotely helpful on google or SO about this.
I have an array of strings and I want to run -split on each string in the array and end up with an array containing arrays of ...
0
votes
3
answers
91
views
Pull specific data from text files in PowerShell with search parameters
We are trying to Pull AP name, bss, and ess values out of text files provided by a network team, in PowerShell 5.1. We have numerous files to go through and multiple AP Targets in each file.
Here's ...
1
vote
1
answer
94
views
Combine Multilines in one element of array
I have part of switch config include all interface ethernet port configuration.
Interface Ethernet1/0/12
switchport mode hybrid
switchport hybrid allowed vlan 21-29 untag
switchport hybrid native ...
1
vote
1
answer
62
views
Powershell insert CR in massive array
I have a massive array of string characters that I would like to insert a carriage return every 10 characters.
For example, if my string array in Powershell is:
all_str_data = ...
2
votes
0
answers
62
views
How does a string unexpectedly become an array?
In one of my script I have the following problem: assigning to a string variable the result of a function makes the string an array. Example:
---------- (function edited for clarity)
$x=""
...
-3
votes
1
answer
39
views
Can anyone tell me why this is returning as a string? PWSH
I'm trying to make an array of strings in PowerShell script. I don't understand why it keeps returning as one long string and the $var.gettype() returns string.
I tried following all of the array ...
1
vote
1
answer
82
views
Trying to import csv string value, with variable within string? [duplicate]
I'm a bit stuck trying to use param values in a string, imported from within a CSV.
I've tried a few methods, and can't seem to enumerate the parameter within the string.
First of all I have a csv ...
1
vote
2
answers
57
views
How can I split a block of text into multiline records based on the starting line?
How can I split this into separate strings/arrays/etc so that I can then iterate on each one separately? The goal is to separate them so that I can then parse each record and insert into a ...
1
vote
1
answer
54
views
Passing multi-line string to PowerShell function parameter
I have the following code:
function Main{
$param1 = @"
aaa
bbb
ccc
"@
Test -Param1 $param1
}
function Test {
param (
[Parameter(Mandatory)][string]$Param1
)
...
0
votes
2
answers
91
views
Powershell convert unordered Text to CSV
I have a system that exports a text file [.txt] and wish to convert the text to a .csv file. The export contains 500+ lines so manual manipulation in Excel is very slow. I have no means of changing ...
0
votes
1
answer
37
views
Search for string in array - Power shell
this is my code
$Packets = @()
$Packets += Test-PXESever -ProcessorArchitecture 0 -Verbose
$Packets += Test-PXESever -ProcessorArchitecture 7 -Verbose
The output of the array $Packets looks like ...
2
votes
1
answer
84
views
Find objects that start with the same value and keep only the longest value in the array Powershell
I am trying to find a solution to filter my array.
For the criterion it would be: if an object of the 3rd column matches (or contains) with another object of this same column. Then delete it.
Here is ...
0
votes
1
answer
237
views
compare 2 arrays for duplicate values in powershell
I'm trying to compare 2 arrays for duplicate entries. If an entry exists in both arrays I want to save that to a variable. Also I'd like for the variable with the information to contain the existing ...