Application Services - Map - Discovery Steps - Not using windows credentials to Test-Path

AkhilkumarP
Tera Contributor

We have created entry point Application services and running discovery from view map.

 

The discovery is failing with following though we have right windows credentials created in service now the command mentioned below error block is working fine:

Error during execution of Windows command: executeCommand -Command '%SystemRoot%\system32\netstat -a -n -o | %SystemRoot%\system32\findstr /R ":80"' -TimeoutSec 60. com.snc.automation_common.integration.exceptions.UnauthorizedAccessException: Test-Path : Access is denied
At C:\ServiceNow\MIDServer\ServiceNow MID Server AWS_RxSense_Midserver\agent\scripts\PowerShell\SecureTempFolder.psm1:66 char:9
+ if (Test-Path -Path $folder -PathType Container) {
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Test-Path], UnauthorizedAccessException
+ FullyQualifiedErrorId : System.UnauthorizedAccessException,Microsoft.PowerShell.Commands.TestPathCommand

Test-Path : Access is denied
At C:\ServiceNow\MIDServer\ServiceNow MID Server AWS_RxSense_Midserver\agent\scripts\PowerShell\SecureTempFolder.psm1:66 char:9
+ if (Test-Path -Path $folder -PathType Container) {
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo

  TEST-PATH -PATH \\<ip address of web server>\c$\temp -PATHTYPE container -Credential LOCALHOST\<user name>

 

 

4 REPLIES 4

AJ-TechTrek
Giga Sage
Giga Sage

Hi @AkhilkumarP ,

 

Please check the access issue on windows Credentials which you are using for Service Mapping Discovery, Windows user should have local admin access.

 

Refer the below docs.

 

https://docs.servicenow.com/bundle/xanadu-platform-security/page/product/credentials/reference/r_Win...

 

Please appreciate the efforts of community contributors by marking appropriate response as Mark my Answer Helpful or Accept Solution this may help other community users to follow correct solution in future.
 
Thank You
AJ - TechTrek with AJ
Linkedin:- https://www.linkedin.com/in/ajay-kumar-66a91385/
YouTube:- https://www.youtube.com/@learnitomwithaj
ServiceNow Community Rising Star 2024

Hi @AJ-TechTrek  

 

The problem is in the above mentioned powershell script the below mentioned line is running without passing "Credentials" or directly from remote without authentication hence it is failing:

if (Test-Path -Path $folder -PathType Container)

 

Same command if we run from MIDServer pointing to remote server folder is working fine:

Test-Path -Path $folder -PathType Container -Creds $cred

so our questions is how can we make sure to use windows credentials for service mappping discovery  and following line works fine

if (Test-Path -Path $folder -PathType Container)

Hi @AJ-TechTrek 

 

The problem is not with permissions but script is not using the windows credentials setup to execute following line of SecureTempFolder.psm1 script

+ if (Test-Path -Path $folder -PathType Container)

 

How can we make sure the secureTempFolder.psm1 script run Test-Path command using windows credentials setup in service now? Because same command passing credentials working fine.

AJ-TechTrek
Giga Sage
Giga Sage

Hi @AkhilkumarP ,

 

Please check the access issue on windows Credentials which you are using for Service Mapping Discovery, Windows user should have local admin access.

 

Refer the below docs.

 

https://docs.servicenow.com/bundle/xanadu-platform-security/page/product/credentials/reference/r_Win...

 

Please appreciate the efforts of community contributors by marking appropriate response as Mark my Answer Helpful or Accept Solution this may help other community users to follow correct solution in future.
 
Thank You
AJ - TechTrek with AJ
Linkedin:- https://www.linkedin.com/in/ajay-kumar-66a91385/
YouTube:- https://www.youtube.com/@learnitomwithaj
ServiceNow Community Rising Star 2024