<h2> The module 'scripts' could not be loaded. For more information, run 'Import-Module scripts'. error while executing Orchestration activity</h2><br/><div style="overflow-x:auto"><article><div ><h3 >Issue </h3><section><style type="text/css"><!-- div.margin { padding: 10px 40px 40px 30px; } table.tocTable { border: 1px solid; border-color: #e0e0e0; background-color: #fff; } .title { color: #d1232b; font-weight: normal; font-size: 28px; } h1 { color: #d1232b; font-weight: normal; font-size: 21px; margin-bottom: 5px; border-bottom-width: 2px; border-bottom-style: solid; border-bottom-color: #cccccc; } h2 { color: #646464; font-weight: bold; font-size: 18px; } h3 { color: #000000; font-weight: bold; font-size: 16px; } h4 { color: #666666; font-weight: bold; font-size: 15px; } h5 { color: #000000; font-weight: bold; font-size: 13px; } h6 { color: #000000; font-weight: bold; font-size:14px; } ul, ol { margin-left: 0; list-style-position: outside; } --></style> <div class="margin"> <h1>Symptoms</h1> <ul style="list-style-position: inside;"><li style="font-size: 10pt;"><span style="font-size: 13.3333px;"><span style="font-size: 10pt; font-family: verdana, geneva;">On executing a custom orchestration workflow, an activity throws an error about the missing module. This article will demonstrate on the investigations and probable use cases, hence in future, if a similar issue is observed, then this can be one of the cause and worth trying to fix.</span></span></li></ul> <h1>Steps to Reproduce</h1> <ul style="list-style-position: inside;"><li style="font-size: 10pt;"><span style="font-size: 9.33333px;"><span style="font-size: 10pt;"><span style="font-family: verdana, geneva;">Note - The below steps are applicable to impacted instance only.</span></span></span><br /> <ul style="list-style-position: inside;"><li style="font-size: 10pt;"><span style="font-size: 9.33333px;"><span style="font-size: 10pt;"><span style="font-family: verdana, geneva;">Connect to the Instance</span></span></span></li><li style="font-size: 10pt;"><span style="font-size: 9.33333px;"><span style="font-size: 10pt;"><span style="font-family: verdana, geneva;">Navigate to Workflow Editor</span></span></span></li><li style="font-size: 10pt;"><span style="font-size: 9.33333px;"><span style="font-size: 10pt;"><span style="font-family: verdana, geneva;">Open the impacted workflow and activity.</span></span></span></li><li style="font-size: 10pt;"><span style="font-size: 9.33333px;"><span style="font-size: 10pt;"><span style="font-family: verdana, geneva;">Click on Start. </span></span></span></li><li style="font-size: 10pt;"><span style="font-size: 9.33333px;"><span style="font-size: 10pt;"><span style="font-family: verdana, geneva;">Once completed, navigate to Workflow All Contexts and open the related record. </span><span style="font-family: verdana, geneva;">In the record open Workflow Log tab where</span><span style="font-family: verdana, geneva;"> see below error message</span></span></span></li></ul> </li></ul> <br /><br /> <pre style="padding-left: 40px;"><span style="font-size: 10pt;">& : The module 'scripts' could not be loaded. For more information, run 'Import-Module scripts'.At line:1 char:6+ & {& 'scripts\PowerShell\PSScript.ps1' -computer '10.43.148.33' -sc ...+<br /> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+CategoryInfo : ObjectNotFound: (scripts\PowerShell\PSScript.ps1:String) [], CommandNotFoundException+ FullyQualifiedErrorId : CouldNotAutoLoadModule</span></pre> <h1>Cause</h1> <ul style="list-style-position: inside;"><li style="font-size: 10pt;"><span style="font-size: 13.3333px;"><span style="font-size: 10pt; font-family: verdana, geneva;">Insufficient privilege to the user running the MID Server service.</span></span></li></ul> <h1>Resolution</h1> <ul style="list-style-position: inside;"><li style="font-size: 10pt;"><span style="font-size: 13.3333px;"><span style="font-size: 10pt; font-family: verdana, geneva;">The error displayed is misleading. The error is not related to the custom activity but is due to permission.</span></span></li><li style="font-size: 10pt;"><span style="font-size: 13.3333px;"><span style="font-size: 13.3333px;"><span style="font-size: 10pt; font-family: verdana, geneva;">In order to fix this issue below steps can be followed.<br /><br /></span></span></span><br /> <ul style="list-style-position: inside;"><li style="font-size: 10pt;"><span style="font-size: 13.3333px;"><span style="font-size: 10pt; font-family: verdana, geneva;">Verify if the module which is shown as missing in the error exists or not. If it does not exists then try adding the missing module.</span></span></li><li style="font-size: 10pt;"><span style="font-size: 13.3333px;"><span style="font-size: 10pt; font-family: verdana, geneva;">Verify the User used for running has sufficient permission to perform the activity. Add local admin privileges to the user to perform the intended operation.</span></span></li><li style="font-size: 10pt;"><span style="font-size: 13.3333px;"><span style="font-size: 10pt; font-family: verdana, geneva;">Execute the MID Server Service using Local Admin user to make it work. Refer <span style="text-decoration: underline;"><a title="How to Configure Windows MID Server service credentials" href="https://docs.servicenow.com/csh?topicname=r_ServiceNowPlatform.html&version=latest" target="_blank" rel="noopener noreferrer nofollow">How to Configure Windows MID Server service credentials</a></span> for more details.</span></span></li></ul> </li></ul> <h1>Additional Information</h1> <ul style="list-style-position: inside;"><li style="font-size: 10pt;"><span style="font-size: 13.3333px;"><span style="font-size: 10pt; font-family: verdana, geneva;">The above steps help to fix the issue reported. </span></span></li><li style="font-size: 10pt;"><span style="font-size: 13.3333px;"><span style="font-size: 10pt; font-family: verdana, geneva;">If even after following above steps if you still see the error then kindly reach out to ServiceNow Technical Support for further assistance. </span></span></li></ul> </div></section></div></article></div>