Solved

Powershell Script error - Exchange

Posted on 2016-10-11
6
39 Views
Last Modified: 2016-11-01
I've found this script that would enable us to input Outlook Calendar meetings into users calendars without an invite.

http://www.slipstick.com/exchange/cmdlets/use-powershell-import-appointments/

 I get an error:
 Unable to index into an object of type System.Management.Automation.PSObject.
 At D:\Program Files\Microsoft\Exchange Server\V14\Bin\Import-CalendarCSV.ps1:72 char:16
 +     if (!$CSVFile[ <<<< 1].$Key)
     + CategoryInfo          : InvalidOperation: (1:Int32) [], RuntimeException
     + FullyQualifiedErrorId : CannotIndex
0
Comment
Question by:mkllpit
  • 3
  • 3
6 Comments
 
LVL 39

Accepted Solution

by:
footech earned 500 total points (awarded by participants)
ID: 41838991
The error happens when your .CSV file only has one line (besides the headers).
You can change line 60 to the following to handle it.
$CSVFile = @(Import-Csv -Path $CSVFileName);

Open in new window

0
 

Author Comment

by:mkllpit
ID: 41839013
thanks. I added a second line, and that error went away. Can you assist with these errors now?

Exception calling "LoadFile" with "1" argument(s): "Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))"
At D:\Admin\Import-CalendarCSV\Import-CalendarCSV\Import-CalendarCSV.ps1:90 char:39
+  [void][Reflection.Assembly]::LoadFile <<<< ($EWSManagedApiPath);
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : DotNetMethodException

Performing autodiscover for sgrossman@mkllptest.com
Exception calling "AutodiscoverUrl" with "1" argument(s): "The Autodiscover service couldn't be located."
At D:\Admin\Import-CalendarCSV\Import-CalendarCSV\Import-CalendarCSV.ps1:120 char:27
+         $service.AutodiscoverUrl <<<< ($EmailAddress);
    + CategoryInfo          : NotSpecified: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : DotNetMethodException
0
 

Author Comment

by:mkllpit
ID: 41839028
Ok, I think I fixed the first error, just this one:

Exception calling "AutodiscoverUrl" with "1" argument(s): "The Autodiscover service couldn't be located."
At D:\Admin\Import-CalendarCSV\Import-CalendarCSV\Import-CalendarCSV.ps1:120 char:27
+         $service.AutodiscoverUrl <<<< ($EmailAddress);
    + CategoryInfo          : NotSpecified: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : DotNetMethodException
0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
LVL 39

Expert Comment

by:footech
ID: 41839255
I don't think I can help you on that one.   Though I do see on line 93 it appears to reference Exchange 2007.  Is that the version you're using?  If not, you might have to change the command.
https://msdn.microsoft.com/en-us/library/microsoft.exchange.webservices.data.exchangeversion%28v=exchg.80%29.aspx?f=255&MSPPError=-2147217396
0
 

Author Comment

by:mkllpit
ID: 41839301
hmmm, good eye, we're using Exchange 2010, I'll check that. Thanks!
0
 
LVL 39

Expert Comment

by:footech
ID: 41868066
Original question was answered.
I'd suggest starting a new question for any follow up questions.
0

Featured Post

Wish Marketing would stop bothering you?

Is your marketing department constantly asking for new email signature updates? Are they requesting a different design for every department? Do they need yet another banner added? Don’t let it get you down! There is an easy way to manage all of these requests...

Join & Write a Comment

Find out how to use Active Directory data for email signature management in Microsoft Exchange and Office 365.
A procedure for exporting installed hotfix details of remote computers using powershell
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now