All Questions
29 questions
2
votes
1
answer
78
views
How to test if an object is any type of array or list?
I want to test if an object is a string or any type of array or list (not hashtable or dictionary, etc.) It seems impossible to test for every type of collection in .NET. I must be missing some ...
0
votes
1
answer
253
views
How to create an associative array out of list generated by a variable in Powershell?
I am connecting to an API and pulling down a list of managers and the markets they have access to with PowerShell. I am then using replace commands to change those markets into corresponding mailboxes ...
0
votes
3
answers
790
views
Powershell: How to print list items in 1 string
Let's say i have this code:
$test = @("apple" , "orange", "pear")
If i do write-host $test[0] i will get apple returned.
If i do write-host $test[0] $test[1] $test[2] i ...
0
votes
1
answer
310
views
Powershell find the lowest string
I printed all employees name in Powershell but now I need to get the longest name between all employees so which code should I write to get??
I have tried this but its only print for me employees ...
0
votes
0
answers
497
views
Get output from PowerShell being called by Python to be formatted like a CSV file so I can take output and put into SQL table
new to coding, self-learning and googling a lot, but cannot find an answer specific to what I am trying to do. I will try my best to describe what I am trying to do, please let me know if you need ...
0
votes
2
answers
1k
views
Looping through 2D array | Powershell
I'm trying to make a script that would let me add phonenumber 2factor for multiple azure users at once from an array/list.
I thought that maybe a 2d array would be a nice solution. and then loop ...
0
votes
3
answers
3k
views
Powershell - print the list length respectively
I want to write two things in Powershell.
For example;
We have a one list:
$a=@('ab','bc','cd','dc')
I want to write:
1 >> ab
2 >> bc
3 >> cd
4 >> dc
I want this to be ...
0
votes
2
answers
541
views
Compare A and B list and create a C list with B values not in A list in Powershell
I have two list, A and B and I needed the element of the B list not present in the A list to be in a created list C in Powershell.
(list or array)
A
B
C
One
One
Second
Two
Two
Three
Three
Third
Second
...
0
votes
1
answer
707
views
Adding Items to an array in a round robin fashion in powershell?
I am starting a project where a .csv file with basic names will be the input.
I need to step through all of the names in this .csv and add them to lists/arrays that have a max limit of 20. Also if the ...
1
vote
2
answers
143
views
Powershell: ForEach loop error, not doing what i want
With my code I am trying to create a folder, then open a certain Excel file, edit it, and save it to the location that has been made via the function Dagcontrole_folders_maken . Currently i am using ...
0
votes
3
answers
437
views
Powershell - Parse duplicates in a list
I'm working on an issue with SCCM delivered App-V connection groups. Occasionally it delivers multiple (duplicate) connection groups to the client and the apps don't function correctly.
I'm running ...
4
votes
2
answers
930
views
PowerShell enumerate an array that contains only one inner array
Conside this:
This is one array and contains only one item. And the item of the array is another array(I call it list object).
I want to get the only list object inside an array.
I use foreach to ...
3
votes
4
answers
4k
views
Tuples/ArrayList of pairs
I'm essentially trying to create a list of pairs which is proving frustratingly difficult
Note before anyone mentions Hashtables that there will be duplicates which I don't care about.
For example, ...
11
votes
3
answers
3k
views
How to convert a HashSet to an ArrayList in PowerShell?
I need to convert a HashSet to an ArrayList?
$hashset = New-Object System.Collections.Generic.HashSet[int]
$hashset.Add(1)
$hashset.Add(2)
$hashset.Add(3)
$arraylist = New-Object System.Collections....
0
votes
2
answers
373
views
Powershell - Append Variable to an Array using For Each
I'm currently trying to add a registry key to mutiple registry folders. However becasue you can't wildcard registry keys via group policy I'm using a ps1 script to add these keys. Essentially I would ...