I suppose that is a possibility. I have this running as a scheduled
task on a system that wouldn't introduce any conflicting Excel
processes. It's probably possible to get the process ID for the Excel
process launched by a specific user account. That then could be passed
to the kill command.

I did confirm that simply quitting Excel does not actually stop the process.

- Sean

> On Apr 6, 2015, at 7:53 PM, Joshua Delaughter <joshua.delaugh...@gmail.com> 
> wrote:
>
> Could the last line possibly kill other Excel instances that might be running?
>
> Does the Quit method in the second to last line not kill the process?
>
> Is there a way to get the PID for the particular instance of Excel that this 
> snippet starts instead?
>
> Sent from my iPhone
>
>> On Apr 6, 2015, at 5:40 PM, Sean Martin <seanmarti...@gmail.com> wrote:
>>
>> Good afternoon,
>>
>> I've been working on a Powershell script to create/update Mail Contacts in 
>> Exchange based on information stored in our SharePoint site. This may be 
>> trivial to some of you, but I thought I would share for those who are 
>> relatively new to Powershell such as myself.
>>
>> Saving the list from Sharepoint to a Web Query File (.IQY) allows for the 
>> presentation of current data each time the file is opened. I had a hard time 
>> figuring out how to work with the file directly, and didn't have the option 
>> of running the script on our Sharepoint server or remotely against it, so I 
>> used the following to save the content as a CSV.
>>
>> # Convert Web Query File to CSV
>> $xl = New-Object -C Excel.Application -vb:$false
>> $xl.DisplayAlerts = $False
>> $iqy = $xl.Workbooks.Open('<path to IQY file'>)
>> $iqy.SaveAs('<Path for saved CSV file>', 6)
>> $iqy.Close($false)
>> $xl.Quit()
>> Get-Process Excel | kill
>>
>> I can't take credit for the above, but it did take some time track it down 
>> so I thought sharing it might help someone else avoid the research time.
>>
>> - Sean
>>
>> ================================================
>> Did you know you can also post and find answers on PowerShell in the forums?
>> http://www.myitforum.com/forums/default.asp?catApp=1
>
>
> ================================================
> Did you know you can also post and find answers on PowerShell in the forums?
> http://www.myitforum.com/forums/default.asp?catApp=1
>


================================================
Did you know you can also post and find answers on PowerShell in the forums?
http://www.myitforum.com/forums/default.asp?catApp=1

Reply via email to