I was just coming back on here to tell everyone that I used that one and change the password section to update the Alias. Thank you very much for your work. I just need to figure out how to make that script open a file, go through each line and pull the alias out of that file, put that alias in the script, change that alias, then move on to the next line.
Here is what I changed.
1sub setalias {
2 my $userURI=shift(@_);
3 my $newalias=shift(@_);
4
5 my $credentials="<User><Alias>$newalias</Alias></User>";
6 my $url="https://$SERVER$userURI";
7 my $ua = LWP::UserAgent->new;
8 my $header = HTTP::Headers->new;
9 $header->header("Content-Type","application/xml");
10 my $req = HTTP::Request->new(PUT => $url, $header, $credentials);
11 $req->authorization_basic($USER,$PASSWORD);
12 my $response = $ua->request($req);
13
14 &checkerror($response);
15}
16
17# Lookup user by alias
18my $URI=&userlookup('OriginalAlias');
19print "Found user: ", $URI, "\n";
20
21# Set password
22&setalias($URI,"NewAlias");
23print "Alias successfuly set!", "\n";