SOLVED

SCCM Package with Powershell script to read from sharepoint

Copper Contributor

Hi All,

i have a powershell script that reads from an Excel file on sharepoint and update my calendar with shifts events. it simply create tasks on my calendar according to what present in excel sheets.

when running the script from my desktop with my user rights (normal user rights -  not admin) the script runs and updates my outlook calendar but when i setup a package on SCCM and set the script to run with user rights  nothing happens when i run it from software center. it runs actually but no updates to my calendar.

any ideas on what could be the Problem / Solution.

I have full access to SCCM so any suggestions can be done and any help is appreciated.

Regards to all

8 Replies

If you are running the script as user then it will execute in the logged in user context. Are you the logged on user?

best response confirmed by AhmedLS (Copper Contributor)
Solution

Then maybe enable logging in your script to gather more data if not already done. 

First test your script using the local system account. How to Access the Local System Account - Recast Software

next add logging to you script to see what is happening as it is running.

you cant run the script using localsystem or admin coz they both dont have access to my outlook calendar. it got to be me or the user who owns the calendar. 

seems like it is running with two different accounts according to the below error message. the package is set to run with logged in user rights. 

 

 

TerminatingError(New-Object): "Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following error: 80080005 Server execution failed (Exception from HRESULT: 0x80080005 (CO_E_SERVER_EXEC_FAILURE))."
New-Object : Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046} failed due
to the following error: 80080005 Server execution failed (Exception from HRESULT: 0x80080005 (CO_E_SERVER_EXEC_FAILURE)

Did you add logging to your script to see what is happening at each step? Keep in mix that package will run as x86, therefore if your script need x64 objects, you will need to relaunch it as x64. 

Yes i enabled logging and thats how i got the error that i posted.

I found out that the reason for all problems is this line

 

set-executionpolicy -scope currentuser -executionpolicy Bypass -Force

 

not sure why but it confilicted with CM running the script as logged in user. when i commented the above line everything started working. 

1 best response

Accepted Solutions
best response confirmed by AhmedLS (Copper Contributor)
Solution

Then maybe enable logging in your script to gather more data if not already done. 

View solution in original post