All Questions
40 questions
0
votes
2
answers
84
views
Powershell : Compare an Hashtable to multiple System.Object and return only the matching one
I'm trying to compare an hashtable to multiple output from Pipeline, in he shortest way ( one line if possible).
Each output will contains at minimum same Property as Key in hashtable, but could have ...
0
votes
2
answers
204
views
Compare two arrays and exclude elements they have in common
My first array contains line of strings ($unprotected, which contains lines such as "this list contains 456454"), which needs to be compared with another array ($blocklist, e.g. @('456454', '...
0
votes
1
answer
203
views
PowerShell Compare-Object filtering
Attempting to filter files from two source locations and one destination. All 3 contain files and are very mismatched.
All files in locations correctly get pulled using:
$Source1Files = Get-ChildItem -...
1
vote
0
answers
43
views
Check that the next FirstOnlyDesignNumber is the value of the previous NextDesignNumber In PowerShell
I have the following code:
try
{
#Connect to the SQL server and retrieves the data
$query = 'Query.sql'
$SQLConnection = Invoke-Sqlcmd2 -ServerInstance "$Instance"...
2
votes
4
answers
80
views
Check if a list of values has the same values as in other list
I parse a text file with values and collect the individual values in a list. If there are sufficient bytes the list is sent to the output in Intel-HEX format. I want to suppress the lines where all ...
0
votes
1
answer
58
views
how do you turn an output string into something you can reference with get-itempropertyvalue?
I'm relatively new to Powershell and stackoverflow so sorry for mistakes.
I have been setting myself things to work on like this so any help is greatly appreciated.
So I'm trying to write a script ...
2
votes
1
answer
685
views
How to find if Powershell Array Contain part of another Array
I have 2 Arrays
$Array1 = Get-Disabledusers SIDS
$Array2 = %Unnecessarytext(SIDS).VHDX
I need to compare Array1 and Array2 and output only the things in Array2 that contain Array1.
Thing is, when I ...
1
vote
0
answers
16
views
How do you print an array based on another arrays position? [duplicate]
I have 2 arrays. If Joe Root is entered and exists, how can I print that array and the age "67" from the other array?
$myarr = ("John Morales", "Joe Root", "Peter ...
0
votes
1
answer
142
views
How to compare an array of numbers with user input?
I have created 3 arrays, which store data from a separate file called household.dat, arr1 holds the ID, arr2 holds the income, and arr3 holds family members. The user is asked to enter an existent id (...
2
votes
2
answers
2k
views
String comparison in PowerShell doesn't seem to work
I am trying to compare strings from one array to every string from the other. The current method works, as I have tested it with simpler variables and it retrieves them correctly. However, the strings ...
0
votes
1
answer
84
views
PowerShell | EVTX | Compare Message with Array (Like)
Thank you for all the help I've gotten so far, much appreciated. I have been trying to achieve a simple task: to compare "Image Path" of a Event ID 7045 with a set of pre-defined keywords. ...
-1
votes
2
answers
137
views
Powershell , array1 , Array2 , find String, replace String
Well i want only to know what i Have to do if that what read out (includs like words like "leiter" in Verkaufsabteilungsleiter or Gesamtleitung and save in Variables like MitgliedÄndern2, $...
1
vote
0
answers
80
views
How to compare system array and system object?
I am trying to get Backup job information and store in $JobInfo variable.
$JobInfo = Invoke-Command -Session $PSSession -ScriptBlock {
Get-VBRJob -name $Using:D_Job -PipelineVariable DJob |...
5
votes
3
answers
1k
views
Prevent adding pscustomobject to array if already exists
I feel silly that I cannot figure this out, but say I have an array containing pscustomobjects. At an incredibly high level take the following example:
$arr = @()
$obj1 = [pscustomobject]@{prop1=&...
0
votes
1
answer
168
views
Powershell comparison for local network drive mappings against an array of drive mappings
I'm developing a PowerShell script for company drive mapping purposes. Currently, the script is getting the logged in username and querying AD to store their groups. From there, we are going to ...