I need to toss usernames into various databases in some form of automated fashion. I've been thinking about this all day and I'm not able to come up with anything to do this. My current thought is to store the letter ranges, and maybe convert them into their equivalent number values.
A = 0
B = 1
and so on.
$MailDatabases = @("User_A-Ad","User_Ae-Ak","User_Al-Amf","User_Amg-Ap","User_Aq-Av","User_Aw-Bd","User_Be-Bj","User_Bk-Bre","User_Brf-Caf","User_Cag-Cc","User_Cd-Chr","User_Chs-Cok","User_Col-Cut","User_Cuu-Dc","User_Dd-Dim","User_Din-Dul","User_Dum-Ekl","User_Ekm-Er","User_Es-Fu","User_Fv-Gp","User_Gq-Hc","User_Hd-Hug","User_Huh-Jam","User_Jan-Jdd","User_Jde-Jgn","User_Jgo-Jlh","User_Jli-Jol","User_Jom-Jsr","User_Jss-Kal","User_Kam-Kc","User_Kd-Kh","User_Ki-Kn","User_Ko-Kt","User_Ku-Lat","User_Lau-Lia","User_Lib-Lor","User_Los-Mag","User_Mah-Maz","User_Mb-Mek","User_Mel-Mir","User_Mis-Mok","User_Mol-Mt","User_Mu-Nga","User_Ngb-Of","User_Og-Pg","User_Ph-Qt","User_Qu-Rez","User_Rf-Ron","User_Roo-Sal","User_Sam-Sco","User_Scp-Shn","User_Sho-smq","User_Smr-Std","User_Ste-Tan","User_Tao-Til","User_Tim-Tr","User_Ts-Vr","User_Vs-Ws","User_Wt-Zz")
$Databases = @()
foreach ($Database in $MailDatabases)
{
$Item = New-Object -TypeName psobject -Property @{
RangeStart = $Database.Split("_")[1].Split("-")[0]
RangeEnd = $Database.Split("_")[1].Split("-")[1]
Value = $Database
}
$Databases += $Item
}Using my own username "jspatton" i should fall into this database "User_Jom-Jsr". So I was thinking something along these lines
# jspatton@IT08082 | 18:14:58 | 09-06-2013 | C:\scripts\powershell\production $
([byte]("J".ToUpper()[0])-65),([byte]("o".ToUpper()[0])-65),([byte]("m".ToUpper()[0])-65)
9
14
12
# jspatton@IT08082 | 18:15:14 | 09-06-2013 | C:\scripts\powershell\production $
([byte]("J".ToUpper()[0])-65),([byte]("s".ToUpper()[0])-65),([byte]("r".ToUpper()[0])-65)
9
18
17
# jspatton@IT08082 | 18:15:29 | 09-06-2013 | C:\scripts\powershell\production $
([byte]("J".ToUpper()[0])-65),([byte]("s".ToUpper()[0])-65),([byte]("p".ToUpper()[0])-65)
9
18
15Jom = 9,14,12
Jsr = 9,18,17
Jsp = 9,18,15
So looking at that I can see that jsp falls between jom and jsr, but not all the databases have 3 character ranges, which honestly I don't think matters. I'm just missing a step somehow. I'm looking for advice or tips on how to do something like this.
thanks!
Jeffrey S. Patton Jeffrey S. Patton Systems Specialist, Enterprise Systems University of Kansas 1001 Sunnyside Ave. Lawrence, KS. 66045 (785) 864-0242 | http://patton-tech.com