Application Services - Map - Discovery Steps - Not using windows credentials to Test-Path
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-17-2024 12:57 PM
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>
- Labels:
-
Service Mapping
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2024 01:22 AM
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.
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2024 11:36 AM
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)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2024 11:42 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-23-2025 01:29 AM
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.
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