RE: AD / ldap update
Thanks all for your assistance. I directly contacted Aaron Giuoco as a result of stumbling across his query here - http://www.nntp.perl.org/group/perl.ldap/2007/02/msg2489.html and he was good enough to provide me his working script. Thanks all who contacted me directly or through the list. I will take a further look at Win32::Exchange as I have a load more Exchange / AD related work coming down the pipe. Regards, Conor Lillis Senior Systems Administrator Group Infrastructure Services – Technical Services Group Operations Anglo Irish Bank Corporation Ltd Tele: +353 1 619 1819 Mobile: +353 86 815 1188 Fax: mailto:conorlil...@angloirishbank.ie www.angloirishbank.ie Please consider the environment before printing this e-mail. -Original Message- From: Steven Manross [mailto:ste...@manross.net] Sent: 24 September 2011 15:45 To: Conor Lillis; perl-win32-users@listserv.ActiveState.com Subject: RE: AD / ldap update So, While you may or may not be using Microsoft Exchange, I wrote a Module that does a lot of Active Directory calls that help you with tasks like adding extra SMTP email addresses, etc (because it gets all this stuff into the correct format. Win32::Exchange does a lot of this for you. It use Win32::OLE to do the AD property sets. It comes with sample scripts, and documentation on how to use each function. While Microsoft decided to only allow Powershell scripting to things like Creating mailboxes in Exchange 2007 and 2010 (which invalidates Perl access to a lot of the functionality of Exchange), Active Directory property modifications should still work fine. However, I don't have a lab to work with against Exchange 2007 at the current time and can't test against that current configuration. The function in question that you really want to pay attention to is SetAttributes.. If you are using Exchange 2007, the SetAttributes parts will still work since you are really just setting AD properties for the user account. I use the CDO.Person interface for making manipulations like that. Here is a slightly modified excerpt from the example script that is provided in my module. If you use Exchange then My example script might work out of the box for you. Otherwise, you might need to edit it a little. If you don't use Exchange, you could take the _E2KSetAttributes or _E55SetAttributes functions and modify it a little to suit your needs. However, either way, this module might give you some insights into how to form the proxyaddresses (as an array) to the LDAP call you are currently trying to make work. http://search.cpan.org/~smanross/Win32-Exchange_v0.046a/ if (!($provider = Win32::Exchange::Mailbox-new($info_store_server))) { print $rtn - Error returning into main from new ($Win32::Exchange::VERSION)\n; exit 0; } if ($ver{ver} =~ /^6\../) { e60(); # E2K03 is the same as E2K. } sub e60 { if ($mailbox = $provider-GetMailbox($mailbox_alias_name)) { print Got Mailbox successfully\n; } else { print Mailbox did not exist\n; exit 0; } #be careful with proxy addresses.. You are deleting any addresses that may exist already #if you set them via ProxyAddresses (you are now forewarned). push (@$proxies,'SMTP:'.$mailbox_alias_name.'@'.$email_domain); push (@$proxies,'SMTP:secondary@'.$email_domain); push (@$proxies,'SMTP:primary@'.$email_domain); push (@$proxies,'SMTP:tertiary@'.$email_domain); $Attributes{IMailRecipient}{ProxyAddresses} = $proxies; if (!$mailbox-SetAttributes(\%Attributes)) { print Error setting 2K Attributes\n; exit 0; } else { print Set Attributes correctly\n; } } Steven From: perl-win32-users-boun...@listserv.activestate.com [mailto:perl-win32-users-boun...@listserv.activestate.com] On Behalf Of Conor Lillis Sent: Thursday, September 22, 2011 4:02 AM To: perl-win32-users@listserv.ActiveState.com Subject: AD / ldap update Hi all, I have a requirement to add a new primary SMTP address to our users, and retain the existing primary SMTP address as an alias. The attribute in AD that holds these values is proxyAddresses. Exchange uses any SMTP values in lowercase (eg smtp:co...@angloirishbank.ie) as aliases, and will stamp outgoing SMTP email with the value that starts with SMTP: uppercase (eg SMTP:conorlil...@angloirishbank.ie). I have attached below the script I am trying to use for proof of concept, and while I am able to retrieve the current attribute values, I am unable to successfully write the new values to AD. I should clarify that I am basing the script on previous working scripts and various articles on the web, and am not a full time coder so layout / coding is not necessarily optimum ;-) Any assistance greatly appreciated. I am testing in disabled accounts in the OU below so as not to impact on live accounts... system(cls); use Net::LDAP; my $PDC = PDC.domain.lan; my $userid = UserID\@domain.lan; my $password = Password; my
Setting file server time
Using Perl 5.8.8. I have both of the Win32 books and I've googled for this but I've come up short. Does anyone know how to set the time on a Windows server from a remote machine? Barry Brevik ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Setting file server time
Also take a look at net time: http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/net_time.mspx?mfr=true Cheers - T -Original Message- From: perl-win32-users-boun...@listserv.activestate.com [mailto:perl-win32-users-boun...@listserv.activestate.com] On Behalf Of Howard Tanner Sent: Monday, September 26, 2011 5:08 PM To: 'Barry Brevik'; perl-win32-users@listserv.ActiveState.com Subject: RE: Setting file server time You can use the DOS TIME command to set the time (it uses military time). To execute it on a remote computer, I recommend psexec from Sysinternals. The advantage of psexec is you don't have to install anything on the remote machine - pstools installs itself there automatically if it needs to (and you have admin rights on the machine). psexec isn't available on its own, you have to download the entire command line suite, called pstools: http://download.sysinternals.com/Files/PsTools.zip ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Setting file server time
NET TIME was my first thought too, but it only allows you to set your time to that of another machine. -Original Message- From: perl-win32-users-boun...@listserv.activestate.com [mailto:perl-win32-users-boun...@listserv.activestate.com] On Behalf Of Tobias Hoellrich Sent: Monday, September 26, 2011 7:12 PM To: 'Barry Brevik'; perl-win32-users@listserv.ActiveState.com Subject: RE: Setting file server time Also take a look at net time: http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en- us/net_time.mspx?mfr=true Cheers - T -Original Message- From: perl-win32-users-boun...@listserv.activestate.com [mailto:perl-win32-users-boun...@listserv.activestate.com] On Behalf Of Howard Tanner Sent: Monday, September 26, 2011 5:08 PM To: 'Barry Brevik'; perl-win32-users@listserv.ActiveState.com Subject: RE: Setting file server time You can use the DOS TIME command to set the time (it uses military time). To execute it on a remote computer, I recommend psexec from Sysinternals. The advantage of psexec is you don't have to install anything on the remote machine - pstools installs itself there automatically if it needs to (and you have admin rights on the machine). psexec isn't available on its own, you have to download the entire command line suite, called pstools: http://download.sysinternals.com/Files/PsTools.zip ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Setting file server time
You can use the DOS TIME command to set the time (it uses military time). To execute it on a remote computer, I recommend psexec from Sysinternals. The advantage of psexec is you don't have to install anything on the remote machine - pstools installs itself there automatically if it needs to (and you have admin rights on the machine). psexec isn't available on its own, you have to download the entire command line suite, called pstools: http://download.sysinternals.com/Files/PsTools.zip -Original Message- From: perl-win32-users-boun...@listserv.activestate.com [mailto:perl-win32-users-boun...@listserv.activestate.com] On Behalf Of Barry Brevik Sent: Monday, September 26, 2011 5:24 PM To: perl-win32-users@listserv.ActiveState.com Subject: Setting file server time Using Perl 5.8.8. I have both of the Win32 books and I've googled for this but I've come up short. Does anyone know how to set the time on a Windows server from a remote machine? Barry Brevik ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Setting file server time
Since the advent of NTP on the Windows platforms I don't remember the last time there was a need to set the time manually :-) Thanks- T -Original Message- From: Howard Tanner [mailto:tan...@optonline.net] Sent: Monday, September 26, 2011 5:26 PM To: Tobias Hoellrich; 'Barry Brevik'; perl-win32-users@listserv.ActiveState.com Subject: RE: Setting file server time NET TIME was my first thought too, but it only allows you to set your time to that of another machine. ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Setting file server time
Yes NTP. Well, if the guy had it setup right it would work, but no. So I had to create an internet time server bot (with a little help) which sets the local machine time. I was hoping to employ a Win32-only solution to then set the domain controller rather than spawn one of the pstools (I am familiar with them). -Original Message- From: perl-win32-users-boun...@listserv.activestate.com [mailto:perl-win32-users-boun...@listserv.activestate.com] On Behalf Of Tobias Hoellrich Sent: Monday, September 26, 2011 4:44 PM To: Howard Tanner; perl-win32-users@listserv.ActiveState.com Subject: RE: Setting file server time Since the advent of NTP on the Windows platforms I don't remember the last time there was a need to set the time manually :-) Thanks- T -Original Message- From: Howard Tanner [mailto:tan...@optonline.net] Sent: Monday, September 26, 2011 5:26 PM To: Tobias Hoellrich; 'Barry Brevik'; perl-win32-users@listserv.ActiveState.com Subject: RE: Setting file server time NET TIME was my first thought too, but it only allows you to set your time to that of another machine. ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs