1

I'm trying to execute the following script on several remote servers and I think the syntax is correct, but it keeps coming back as "access denied". A few things to note - I am executing the script as an admin on the destination boxes, so creds shouldn't be an issue. I also tried using -cred just in case and the same error occurs.

Essentially what the script is trying to do is execute the nsrports command from that static location and change the port range, then recycle the networker service.

$servers = Get-Content Z:\scripts\computers2.txt
invoke-command -ComputerName $servers -ScriptBlock {cd "C:\Program 
Files\Legato\nsr\bin\"; .\nsrports -s "7937-9000"}  
Restart-service -DisplayName "*Networker Remote Display Service" -force

Output:

Program 'nsrports.exe' failed to execute: Access is denied
At line:1 char:50
+ cd "C:\Program Files\Legato\nsr\bin\"; .\nsrports <<<<  -s "7937-9000".
+ CategoryInfo          : ResourceUnavailable: (:) [], 
ApplicationFailedException
+ FullyQualifiedErrorId : NativeCommandFailed

Any thoughts / suggestions are greatly appreciated!

mosaic3
  • 11
  • 1
  • 2
  • Hate to break it but it *is* a credentials issue. Can you run procmon on that server and execute your script again? – Lieven Keersmaekers May 12 '17 at 14:12
  • If I run it locally on the server, it runs fine. I'll try the procmon route though. – mosaic3 May 12 '17 at 14:24
  • Ah, misunderstanding. I meant *"run procmon on that server and execute your script from your workstation again"* – Lieven Keersmaekers May 12 '17 at 17:01
  • Yep, all clear @Lieven Keersmaekers. I ran procmon and it looks like the denies are occurring on the create requests. – mosaic3 May 12 '17 at 17:20
  • Date & Time: 5/12/2017 1:03:05 PM Event Class: File System Operation: CreateFile Result: ACCESS DENIED Path: C:\Program Files\Legato\nsr\bin\nsrports.exe TID: 36860 Duration: 0.0000333 Desired Access: Read Data/List Directory, Execute/Traverse, Read Attributes, Synchronize Disposition: Open Options: Synchronous IO Non-Alert, Non-Directory File Attributes: n/a ShareMode: Read, Delete AllocationSize: n/a Impersonating: ********* – mosaic3 May 12 '17 at 17:22
  • 1
    If you doubleclick the event, you can get the user executing the process in the Process tab. That user doesn't have permissions to nsrports.exe. – Lieven Keersmaekers May 12 '17 at 20:33

0 Answers0