How to execute PowerShell Commands from MID server Windows Machine SummaryWhen actions in a ServiceNow instance fail due to authentication or permission issues with AD (Active Directory) or Exchange spokes, it typically indicates problems in one or more areas. Here’s a breakdown of common causes and troubleshooting steps: Invalid Credentials : The credentials used in the connection alias for AD/Exchange spokes may be incorrect or expired. Permission Issues : The service account being used may lack the necessary permissions to perform the action on AD/Exchange. validating credentials and permissions directly from the MID server using PowerShell is an excellent approach. This ensures that the MID server can communicate with the target systems (Active Directory or Exchange) and confirms that the credentials and permissions are configured correctly. > Login to the Windows Machine where MID server is installed > Once you login to the machine , We need to open Windows PowerShell ISE Tool to run the commands Click start -> Windows PowerShell ISE -> Right Click and Run as administrator . Refer below screenshot >We can see something like below Sample PowerShell scripts to validate at MID server 1) retrieve user information from Active Directory (AD) using PowerShell, you can use the Get-ADUser cmdlet, which is part of the Active Directory module for Windows PowerShell. Here's an example of a basic command to retrieve user information: Get-ADUser -Identity <username> -Server <AD Server IP> -Credential (Get-Credential) <username> : any user name we can provide <AD Server IP> : AD host machine IP, where we provided in our connection record (Get-Credential) : This command will ask credentials , please enter credentials used in the instance 2) To create a user in Active Directory using PowerShell, you can use the New-ADUser cmdlet. Here's an example of a working command: New-ADUser -Name <username> -City <cityname> -Server <AD Server IP> -Credential (Get-Credential)