Quantcast
Channel: /r/powershell – How to Code .NET
Viewing all articles
Browse latest Browse all 8793

Possible Nested Foreach loop?

$
0
0

Hey all!

I’m trying to come up with the simplest way to copy user profiles to a shared drive for an upcoming project. I’m not sure if this is correct or not as I’ve never done something similar to this, but I was thinking of using a nested Foreach to iterate through a list of computer names and a list of usernames.

Basically I want 2 lists that would more or less look like this

$Computers listed are 1, 2, 3, 4, 5

$Usernames listed are a, b, c, d, e

I want to pull in $computerc$users$usernamesxxxxxxx

where $computers would be 1 and $usernames would be a. $computers would be 2 and $usernames would be b. etc. etc.

Is a Nested Foreach the right way of looking at this or does someone else have a better idea?

submitted by /u/Suihaki
[link] [comments]

The post Possible Nested Foreach loop? appeared first on How to Code .NET.


Viewing all articles
Browse latest Browse all 8793