Skip to content
+1-888-319-3663

EONE BLOG

Tech Tuesday: Using PowerShell to Create SmartConnect Event Log


This week’s Tech Tuesday is from our Support Guru, Pat Roth on SmartConnect:
 
In this column, we are going to use PowerShell to resolve a couple of issues I’ve seen.

The first one is an error you may get when running an integration.

The error is:

[The source was not found, but some or all event logs could not be searched. Inaccessible logs: Security.]

The background for this error is that when SmartConnect encounters an error, it writes it to the SmartConnect event log. In order to do this, you need to register your event log with Windows but good coding practices means that the developer should first check to see if the event source exists before trying to create it.

This should have happened during the install but for some reason it did not and now the user would get this error.

I talk about this registration process in another blog article I wrote a number of years ago for those readers that are interested in the details.

The second “issue” is more of a “nice to have” feature.

Typically on the SmartConnect install, SmartConnect gets registered to the SmartConnect event log. But sometimes we have seen it get registered to the Windows Application event log.

While this doesn’t cause any harm to the system – SmartConnect will work fine – it does cause a bit of confusion for the end user when you read a Knowledgebase article or talk to support when we ask you to “check the SmartConnect event log for errors” since the machine doesn’t have one.

To resolve both of these issues, I’ve created a PowerShell script that registers the SmartConnect event log sources in the expected locations.

To run the PowerShell script (found here):

Make sure to log into the machine as a user with Administrator rights to the machine.

Download and copy the eOne_RegisterEventSource.ps1 file to a convenient location. Since we will have to manually type in the path to the file, I chose a nice easy path – c:temp
Launch PowerShell on your computer. How you do this depends on your Windows version. On my Windows 8 machine, I just searched for it. Make sure to “run as administrator”


The PowerShell command window will open in “Administrator” mode.

The next thing we need to do is make sure that we can actually execute PowerShell code. By default in Windows, it is disabled.

At the command prompt, type in (one line at a time)


$policy = Get-ExecutionPolicy

Set-ExecutionPolicy Unrestricted

The first line gets the current state of the execution policy for use later. The second line changes the execution policy to run any PowerShell code.

When you run the Set-ExecutionPolicy line, you will get a Security prompt:




Press the Enter key to accept this.

Next, we need to execute the eOne_RegisterEventSource.ps1 script.

This is where copying the file to a short path is convenient – enter the path to the file next and then press Enter to execute the script.


The window should now show that the script executed.


The output of the script should be:

Register: eOneSmartConnect
Register: Smart Connect Service
Done!

If you get any other output – typically in red – that means an error occurred. Most likely the error is either you aren’t admin on the machine and therefore cannot read the event source (the error we are trying to fix in SmartConnect) or else possibly you didn’t run PowerShell using “run as administrator”.

Assuming we made it this far, the last step is optional. We should set the execution policy to what it was previously – most likely Restricted.

Set-ExecutionPolicy $policy

You will get the same Security message as before and again press Enter to accept the change.


If we are creating the new event logs, that will take effect right away – SmartConnect should no longer give the Security logs error message that it did previously.  I should note that the powershell script also registers the eConnect event log as well as that event log source is also sometimes not registered properly.

If we are changing the SmartConnect source to use the SmartConnect event log, you will have to reboot your machine for this to take effect.

Do you have a topic you'd like discussed for the next Tech Tuesday? Email us at sales@eonesolutions.com!


4 Comments

  1. Mick on August 24, 2015 at 9:11 pm

    Perfect.

  2. Richard on September 12, 2018 at 11:21 pm

    Thanks Patrick – this fix worked.

  3. Kaushal on August 6, 2019 at 9:15 pm

    Thanks, worked like a charm.

  4. Victoria Yudin on August 11, 2020 at 12:29 pm

    Patrick, this really helped me out today – thank you so much for the detailed writeup! Hope you are well, Victoria Yudin

Leave a Comment





RECENT POSTS


2021 Q4 Promotions
Connect with us at Directions EMEA 2021 in Milan!
eOne at Summit North America 2021
Employee Spotlight: Megan Tripp, Business Development Representative
eOne is now compatible with Microsoft Dynamics GP October 2021 Release

POPULAR POSTS


2016 SmartConnect Integration Bootcamps
Tech Tues: Automatically refreshing Pivot Tables in Excel Refreshable Reports
Happy Thanksgiving from the eOne team!
2017 SmartConnect Integration Bootcamps
New Releases of Extender and SmartList Builder

CATEGORIES

TAGS

Business Central CRM D365 Business Central Dynamics 365 dynamics crm Dynamics GP Dynamics NAV Econnect Employee Spotlight eone eOne News error Error Message Events Excel Excel Report Builder Extender Flexicoder GP integration Map Meet the Team Microsoft dynamics crm Microsoft Dynamics GP Navigation List Builder Office Relationships partners Popdock release Reporting SalesForce SalesForce.com SmartConnect SmartConnect.com SmartConnect Bootcamp SmartConnect Maps SmartConnect Office Hours SmartList SmartList Builder SmartPost SmartView SQL Tech Tuesday Templates training

Integrate & Automate without Any Code.

SmartList Data has Never Been Faster.

The Easiest Way to Report on GP Data.