![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Comparing arrays Hi all: Working on a project to identify home folders that are associated with a disabled AD account. I have 2 arrays, one has the list of home folders, the other contains a list of user accounts, with home drive, home directory, employee id, email address, etc that I gathered using get-qaduser cmdlet. I've been successful in the past comparing 2 simple arrays, but I'm having problems with this one. I think the user array is a multidimensional array, from what I've read, and that's what's tripping me up. How can this be done? Thanks in advance... |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Comparing arrays On Apr 9, 9:48*pm, Mike <thelotu...@xxxxxx> wrote: Quote: > Hi all: > > Working on a project to identify home folders that are associated with > a disabled AD account. I have 2 arrays, one has the list of home > folders, the other contains a list of user accounts, with home drive, > home directory, employee id, email address, etc that I gathered using > get-qaduser cmdlet. I've been successful in the past comparing 2 > simple arrays, but I'm having problems with this one. I think the user > array is a multidimensional array, from what I've read, and that's > what's tripping me up. How can this be done? > > Thanks in advance... task. Before we give you a push in the right direction, though, we could use some more information. What you have described is not two arrays, but either an array and a hash, or an array and an object. Can you give us more information without revealing anytihng confidential or proprietery? |
My System Specs![]() |
| | #3 (permalink) |
| | Re: Comparing arrays On Apr 10, 12:47*am, tojo2000 <tojo2...@xxxxxx> wrote: Quote: > On Apr 9, 9:48*pm, Mike <thelotu...@xxxxxx> wrote: > Quote: > > Hi all: Quote: > > Working on a project to identify home folders that are associated with > > a disabled AD account. I have 2 arrays, one has the list of home > > folders, the other contains a list of user accounts, with home drive, > > home directory, employee id, email address, etc that I gathered using > > get-qaduser cmdlet. I've been successful in the past comparing 2 > > simple arrays, but I'm having problems with this one. I think the user > > array is a multidimensional array, from what I've read, and that's > > what's tripping me up. How can this be done? Quote: > > Thanks in advance... > This sounds like two arrays are the wrong data structures for the > task. *Before we give you a push in the right direction, though, we > could use some more information. *What you have described is not two > arrays, but either an array and a hash, or an array and an object. > Can you give us more information without revealing anytihng > confidential or proprietery? information and post later today. |
My System Specs![]() |
| | #4 (permalink) |
| | Re: Comparing arrays On Apr 10, 12:47*am, tojo2000 <tojo2...@xxxxxx> wrote: Quote: > On Apr 9, 9:48*pm, Mike <thelotu...@xxxxxx> wrote: > Quote: > > Hi all: Quote: > > Working on a project to identify home folders that are associated with > > a disabled AD account. I have 2 arrays, one has the list of home > > folders, the other contains a list of user accounts, with home drive, > > home directory, employee id, email address, etc that I gathered using > > get-qaduser cmdlet. I've been successful in the past comparing 2 > > simple arrays, but I'm having problems with this one. I think the user > > array is a multidimensional array, from what I've read, and that's > > what's tripping me up. How can this be done? Quote: > > Thanks in advance... > This sounds like two arrays are the wrong data structures for the > task. *Before we give you a push in the right direction, though, we > could use some more information. *What you have described is not two > arrays, but either an array and a hash, or an array and an object. > Can you give us more information without revealing anytihng > confidential or proprietery? lines as you, so I tried to export only the HomeDirectory field to another array and compare it, but that seemed kinda hacky, and I'm hoping there was a way to do this without creating another array. My user object and home drive array details are below. $UserAccountDetailList | Get-Member TypeName: System.Management.Automation.PSCustomObject Name MemberType Definition ---- ---------- ---------- Equals Method System.Boolean Equals(Object obj) GetHashCode Method System.Int32 GetHashCode() GetType Method System.Type GetType() ToString Method System.String ToString() AccountIsDisabled NoteProperty System.Boolean AccountIsDisabled=False CanonicalName NoteProperty System.String CanonicalName=company.com/ Departments/branch0101/Users/Staff/000010101 cn NoteProperty System.String cn=000010101 company-userstatus NoteProperty System.String company-userstatus=A createtimestamp NoteProperty System.DateTime createtimestamp=8/23/2002 2:51:50 AM DisplayName NoteProperty System.String DisplayName=Smith, James E Email NoteProperty System.String Email=jesmith@xxxxxx HomeDirectory NoteProperty System.String HomeDirectory=\\br1-home \home\JESmith HomeDrive NoteProperty System.String HomeDrive=H: LogonName NoteProperty System.String LogonName=JESmith $ServerFoldersListWithSize | Get-Member TypeName: System.String Name MemberType Definition ---- ---------- ---------- Clone Method System.Object Clone() CompareTo Method System.Int32 CompareTo(Object value), System.Int32 CompareTo(String strB) Contains Method System.Boolean Contains(String value) CopyTo Method System.Void CopyTo(Int32 sourceIndex, Char[] destination, Int32 destinationIndex, Int32 count) EndsWith Method System.Boolean EndsWith(String value), System.Boolean EndsWith(String value, StringComparison comparisonType), System.Boolean EndsWith(String value, Boolean ... Equals Method System.Boolean Equals(Object obj), System.Boolean Equals(String value), System.Boolean Equals (String value, StringComparison comparisonType) GetEnumerator Method System.CharEnumerator GetEnumerator() GetHashCode Method System.Int32 GetHashCode() GetType Method System.Type GetType() GetTypeCode Method System.TypeCode GetTypeCode() get_Chars Method System.Char get_Chars(Int32 index) get_Length Method System.Int32 get_Length() IndexOf Method System.Int32 IndexOf(Char value), System.Int32 IndexOf(Char value, Int32 startIndex), System.Int32 IndexOf(Char value, Int32 startIndex, Int32 count), System... IndexOfAny Method System.Int32 IndexOfAny(Char[] anyOf), System.Int32 IndexOfAny(Char[] anyOf, Int32 startIndex), System.Int32 IndexOfAny(Char[] anyOf, Int32 startIndex, Int32... Insert Method System.String Insert(Int32 startIndex, String value) IsNormalized Method System.Boolean IsNormalized(), System.Boolean IsNormalized(NormalizationForm normalizationForm) LastIndexOf Method System.Int32 LastIndexOf(Char value), System.Int32 LastIndexOf(Char value, Int32 startIndex), System.Int32 LastIndexOf(Char value, Int32 startIndex, Int32 co... LastIndexOfAny Method System.Int32 LastIndexOfAny(Char [] anyOf), System.Int32 LastIndexOfAny(Char[] anyOf, Int32 startIndex), System.Int32 LastIndexOfAny(Char[] anyOf, Int32 start... Normalize Method System.String Normalize(), System.String Normalize(NormalizationForm normalizationForm) PadLeft Method System.String PadLeft(Int32 totalWidth), System.String PadLeft(Int32 totalWidth, Char paddingChar) PadRight Method System.String PadRight(Int32 totalWidth), System.String PadRight(Int32 totalWidth, Char paddingChar) Remove Method System.String Remove(Int32 startIndex, Int32 count), System.String Remove(Int32 startIndex) Replace Method System.String Replace(Char oldChar, Char newChar), System.String Replace(String oldValue, String newValue) Split Method System.String[] Split(Params Char[] separator), System.String[] Split(Char[] separator, Int32 count), System.String[] Split(Char[] separator, StringSplitOpti... StartsWith Method System.Boolean StartsWith (String value), System.Boolean StartsWith(String value, StringComparison comparisonType), System.Boolean StartsWith(String value, Bo... Substring Method System.String Substring(Int32 startIndex), System.String Substring(Int32 startIndex, Int32 length) ToCharArray Method System.Char[] ToCharArray(), System.Char[] ToCharArray(Int32 startIndex, Int32 length) ToLower Method System.String ToLower(), System.String ToLower(CultureInfo culture) ToLowerInvariant Method System.String ToLowerInvariant () ToString Method System.String ToString(), System.String ToString(IFormatProvider provider) ToUpper Method System.String ToUpper(), System.String ToUpper(CultureInfo culture) ToUpperInvariant Method System.String ToUpperInvariant () Trim Method System.String Trim(Params Char [] trimChars), System.String Trim() TrimEnd Method System.String TrimEnd(Params Char[] trimChars) TrimStart Method System.String TrimStart(Params Char[] trimChars) Chars ParameterizedProperty System.Char Chars(Int32 index) {get;} Length Property System.Int32 Length {get;} |
My System Specs![]() |
| | #5 (permalink) |
| | Re: Comparing arrays On Apr 14, 2:38*pm, Mike <thelotu...@xxxxxx> wrote: Quote: > On Apr 10, 12:47*am, tojo2000 <tojo2...@xxxxxx> wrote: > > > Quote: > > On Apr 9, 9:48*pm, Mike <thelotu...@xxxxxx> wrote: Quote: Quote: > > > Hi all: Quote: Quote: > > > Working on a project to identify home folders that are associated with > > > a disabled AD account. I have 2 arrays, one has the list of home > > > folders, the other contains a list of user accounts, with home drive, > > > home directory, employee id, email address, etc that I gathered using > > > get-qaduser cmdlet. I've been successful in the past comparing 2 > > > simple arrays, but I'm having problems with this one. I think the user > > > array is a multidimensional array, from what I've read, and that's > > > what's tripping me up. How can this be done? Quote: Quote: > > > Thanks in advance... Quote: > > This sounds like two arrays are the wrong data structures for the > > task. *Before we give you a push in the right direction, though, we > > could use some more information. *What you have described is not two > > arrays, but either an array and a hash, or an array and an object. > > Can you give us more information without revealing anytihng > > confidential or proprietery? > Here's some further detail. I was originally thinking along the same > lines as you, so I tried to export only the HomeDirectory field to > another array and compare it, but that seemed kinda hacky, and I'm > hoping there was a way to do this without creating another array. My > user object and home drive array details are below. > > $UserAccountDetailList | Get-Member > > * *TypeName: System.Management.Automation.PSCustomObject > > Name * * * * * * *MemberType * Definition > ---- * * * * * * *---------- * ---------- > Equals * * * * * *Method * * * System.Boolean Equals(Object obj) > GetHashCode * * * Method * * * System.Int32 GetHashCode() > GetType * * * * * Method * * * System.Type GetType() > ToString * * * * *Method * * * System.String ToString() > AccountIsDisabled NoteProperty System.Boolean AccountIsDisabled=False > CanonicalName * * NoteProperty System.String CanonicalName=company.com/ > Departments/branch0101/Users/Staff/000010101 > cn * * * * * * * *NoteProperty System.String cn=000010101 > company-userstatus * *NoteProperty System.String company-userstatus=A > createtimestamp * NoteProperty System.DateTime > createtimestamp=8/23/2002 2:51:50 AM > DisplayName * * * NoteProperty System.String DisplayName=Smith, James > E > Email * * * * * * NoteProperty System.String Email=jesm...@xxxxxx > HomeDirectory * * NoteProperty System.String HomeDirectory=\\br1-home > \home\JESmith > HomeDrive * * * * NoteProperty System.String HomeDrive=H: > LogonName * * * * NoteProperty System.String LogonName=JESmith > > $ServerFoldersListWithSize | Get-Member > > * *TypeName: System.String > > Name * * * * * * MemberType * * * * * *Definition > ---- * * * * * * ---------- * * * * * *---------- > Clone * * * * * *Method * * * * * * * *System..Object Clone() > CompareTo * * * *Method * * * * * * * *System.Int32 CompareTo(Object > value), System.Int32 CompareTo(String strB) > Contains * * * * Method * * * * * * * *System.Boolean Contains(String > value) > CopyTo * * * * * Method * * * * * * * *System.Void CopyTo(Int32 > sourceIndex, Char[] destination, Int32 destinationIndex, Int32 count) > EndsWith * * * * Method * * * * * * * *System.Boolean EndsWith(String > value), System.Boolean EndsWith(String value, StringComparison > comparisonType), System.Boolean EndsWith(String value, Boolean ... > Equals * * * * * Method * * * * * * * *System.Boolean Equals(Object > obj), System.Boolean Equals(String value), System.Boolean Equals > (String value, StringComparison comparisonType) > GetEnumerator * *Method * * * * * * * *System.CharEnumerator > GetEnumerator() > GetHashCode * * *Method * * * * * * * *System.Int32GetHashCode() > GetType * * * * *Method * * * * * * * *System.Type GetType() > GetTypeCode * * *Method * * * * * * * *System.TypeCode GetTypeCode() > get_Chars * * * *Method * * * * * * * *System.Char get_Chars(Int32 > index) > get_Length * * * Method * * * * * * * *System.Int32get_Length() > IndexOf * * * * *Method * * * * * * * *System.Int32 IndexOf(Char > value), System.Int32 IndexOf(Char value, Int32 startIndex), > System.Int32 IndexOf(Char value, Int32 startIndex, Int32 count), > System... > IndexOfAny * * * Method * * * * * * * *System.Int32IndexOfAny(Char[] > anyOf), System.Int32 IndexOfAny(Char[] anyOf, Int32 startIndex), > System.Int32 IndexOfAny(Char[] anyOf, Int32 startIndex, Int32... > Insert * * * * * Method * * * * * * * *System.String Insert(Int32 > startIndex, String value) > IsNormalized * * Method * * * * * * * *System.BooleanIsNormalized(), > System.Boolean IsNormalized(NormalizationForm normalizationForm) > LastIndexOf * * *Method * * * * * * * *System.Int32LastIndexOf(Char > value), System.Int32 LastIndexOf(Char value, Int32 startIndex), > System.Int32 LastIndexOf(Char value, Int32 startIndex, Int32 co... > LastIndexOfAny * Method * * * * * * * *System.Int32 LastIndexOfAny(Char > [] anyOf), System.Int32 LastIndexOfAny(Char[] anyOf, Int32 > startIndex), System.Int32 LastIndexOfAny(Char[] anyOf, Int32 start... > Normalize * * * *Method * * * * * * * *System.String Normalize(), > System.String Normalize(NormalizationForm normalizationForm) > PadLeft * * * * *Method * * * * * * * *System.String PadLeft(Int32 > totalWidth), System.String PadLeft(Int32 totalWidth, Char paddingChar) > PadRight * * * * Method * * * * * * * *System.String PadRight(Int32 > totalWidth), System.String PadRight(Int32 totalWidth, Char > paddingChar) > Remove * * * * * Method * * * * * * * *System.String Remove(Int32 > startIndex, Int32 count), System.String Remove(Int32 startIndex) > Replace * * * * *Method * * * * * * * *System.String Replace(Char > oldChar, Char newChar), System.String Replace(String oldValue, String > newValue) > Split * * * * * *Method * * * * * * * *System..String[] Split(Params > Char[] separator), System.String[] Split(Char[] separator, Int32 > count), System.String[] Split(Char[] separator, StringSplitOpti... > StartsWith * * * Method * * * * * * * *System.Boolean StartsWith > (String value), System.Boolean StartsWith(String value, > StringComparison comparisonType), System.Boolean StartsWith(String > value, Bo... > Substring * * * *Method * * * * * * * *System.String Substring(Int32 > startIndex), System.String Substring(Int32 startIndex, Int32 length) > ToCharArray * * *Method * * * * * * * *System.Char[] ToCharArray(), > System.Char[] ToCharArray(Int32 startIndex, Int32 length) > ToLower * * * * *Method * * * * * * * *System.String ToLower(), > System.String ToLower(CultureInfo culture) > ToLowerInvariant Method * * * * * * * *System.String ToLowerInvariant > () > ToString * * * * Method * * * * * * * *System.String ToString(), > System.String ToString(IFormatProvider provider) > ToUpper * * * * *Method * * * * * * * *System.String ToUpper(), > System.String ToUpper(CultureInfo culture) > ToUpperInvariant Method * * * * * * * *System.String ToUpperInvariant > () > Trim * * * * * * Method * * * * * * * *System..String Trim(Params Char > [] trimChars), System.String Trim() > TrimEnd * * * * *Method * * * * * * * *System.String TrimEnd(Params > Char[] trimChars) > TrimStart * * * *Method * * * * * * * *System.String TrimStart(Params > Char[] trimChars) > Chars * * * * * *ParameterizedProperty System.Char Chars(Int32 index) > {get;} > Length * * * * * Property * * * * * * *System.Int32 Length {get;} $ServerFoldersListWithSize. I'm using a split to compare the folder name. user1,3.05 user2,0.10 user3,1.47 user4,0.09 user5,0.25 user6,6.66 |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Question About arrays | VB Script | |||
| Arrays | PowerShell | |||
| Overwriting Arrays | PowerShell | |||
| Arrays in Powershell | PowerShell | |||
| Bug with multidimensional arrays | PowerShell | |||