Solved

Powershell Script error - Exchange

Posted on 2016-10-11
6
43 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Utilizing an array to gracefully append to a list of EmailAddresses
Scam emails are a huge burden for many businesses. Spotting one is not always easy. Follow our tips to identify if an email you receive is a scam.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

861 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

25 Experts available now in Live!

Get 1:1 Help Now