Troubleshooting PowerShell Script Issues with PowerShell Step and SpokesSummaryPowerShell is a command-line shell and scripting language. Used for Task automation and configuration management. Automate tasks any task on windows such as Active Directory and Exchange In this article, we will explore effective strategies for troubleshooting issues related to PowerShell scripts. We will specifically focus on using PowerShell Step and addressing common Spokes issues.Related LinksIn the PowerShell step, the authentication process follows these steps: When we perform a Test in the PowerShell step, the initial call is made to the Java layer.From there, the PSScript.ps1 file is invoked.The Credentials.psm1 module is then triggered. PSScript.ps1: This is the main wrapper script for all PowerShell scripts executed by the MID Server. This script "Credentials.psm1" Manages credential testing to see if there is proper access to a target system, refer below functions testCredentialAD ( This function execute if credType is AD)testCredentialExchange ( This function execute if credType is Exchange)testCredentialWMI: used by Test Connection button ( This is by default) Debug Option 1 : If we encounter any authentication issues with the PowerShell Step. we can follow below steps to debug : In PowerShell Step, Under "Script Details" go to "Script Type" select "Inline Script". In command Section write below command. Write-host "test log printing"; or Write-Output "test log printing"; ( Preferred ) Refer below screenshot. Once we perform the "Test", refer to the execution details. You will see the log printing under Step Output Data, as shown in the screenshot below. If the log is present, it indicates that the action authentication was successful and there are no issues with credential authentication. Debug Option 2 : Write-output "any string"; We can also print the variable input values at runtime to verify the data being sent to Active Directory (AD) or other integrations while executing the PowerShell script. > In the instance go to MID server -> Script Files -> Here you can see all PowerShell script file I am opening one of the files to check the username being sent to Active Directory (AD). Please refer to the screenshot below. Refer to the execution details below, where we can see the runtime values being passed to the PowerShell script :