Hi All
I have a really hard script that I need desperate help on. If anyone can help so that I can schedule to run over night, every night? PS my scripting knowledge is as good as a hamster.
I need help creating a powershell script and or VB scripts for Exchange online to automatically add contacts and add them to a mail enabled group (not public folder or tradition distribution list).
Step one
convert a xlsx file in to a csv files (this xlsx file is created every night probably with a different file name every night). The cloumns in the cvs will be first name , last name, ExternalEmailAddress, OrganizationUnit. I will probably have a batch file run to delete any other excel or csv files in this folder before the new xlsx file is created
step two
To be able to run a scheduled powershell to automatically connect to exchange online without any interaction
I got as far as this but it keeps prompting for username and password:
Set-ExecutionPolicy RemoteSigned -Scope Currentuser
$credential = get-credential
Import-Module MSOnline
Connect-MsolService -Credential $credential
$ExchangeSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri "
https://outlook.office365.com/powershell-liveid/" -Credential $credential -Authentication "Basic" -AllowRedirection
Import-PSSession $ExchangeSession
step three
Delete all of my contacts in exchange on line
Step four
Using the converted CSV file automatically import contacts to a exchange group (first name , Last name and email address only).
If the exchange group does not exist then create a group with the email address (groupname@example.com)
step five
All of the above will be a scheduled task from the on premises application server.
Background
My bespoke management system is constantly being updated on a daily basis with clients constantly being added and removed from distribution lists. This is becoming a nightmare to administer so I thought that if I could get my management system to export a report and then use that report to carry out the admin at night time it would save me hours of work each week.
I know its a hard one but I'm sure one or more of you have the knowledge(fingers crossed)
Many thanks
Simon
Our community of experts have been thoroughly vetted for their expertise and industry experience.
The Most Valuable Expert award recognizes technology experts who passionately share their knowledge with the community, demonstrate the core values of this platform, and go the extra mile in all aspects of their contributions. This award is based off of nominations by EE users and experts. Multiple MVEs may be awarded each year.
The Distinguished Expert awards are presented to the top veteran and rookie experts to earn the most points in the top 50 topics.