How can I enable a shared folder on a remote server

brianhampson
Giga Contributor

As part of an Employee onboarding process, we want to create and enable a share for a home drive on a remote server.   We have credentials that give us Domain Admin rights (don't ask - it just is that way) but are unable to get a powershell script to be able to access the administrative share on the server.   We get back "Access is Denied"

for a test, running the following command results in "Access is Denied"   while running it from a regular powershell environment works and return

Get-ChildItem \\Servername\d$\Users

This is a bit frustrating, and I hope that someone could help out.

Thanks!

1 ACCEPTED SOLUTION

brianhampson
Giga Contributor

We found a "solution"



The Orchestration MidServer Service was running as Local Service.   We set the login to the SVC.SnowOrc user and then we could access the share.



Seems like this is what all the Credentials should have done, but...   Live and learn I guess.


View solution in original post

5 REPLIES 5

VivekSattanatha
Mega Sage
Mega Sage

Hi Brian,



If your Get-ChildItem command giving results from MID Server then do the following things.



1) Try to run your MID Server service with the credential you mentioned( The one having domain admin rights)


2) In your ServiceNow PowerShell activity change your target host as MID Server IP.


3) Try run the command again



Let me know if that works.



Regards,


Vivek


Thanks for the quick reply.



I tried that and got the following error output:



Authentication failure(s) with available Windows credentials from the instance. Credentials tried: ******\SVC.SnowOrc,SVC.snoworc@*******.com,*******\hpsim


Access is deniedStack Trace:       at Microsoft.PowerShell.Commands.FileSystemProvider.ItemExists(String path, ErrorRecord& error)



When run directly on the midserver:



PS C:\Users\SVC.SNOWOrc> Get-ChildItem \\Servername\d$



Directory: \\Servername\d$


Mode                               LastWriteTime       Length Name                                                                                                                                
----                               -------------       ------ ----                                                                                                                                


d----               10/23/2013   11:58 AM                       app                                                                                                                                    
d----                   8/1/2012   12:52 PM                       ArchiveStaging                                                                                                            
d----               5/10/2017   9:04 AM                       DFSRoots                                    


Hi Brian,



Usually, when you give target host as MID Server, ServiceNow always use MID Server credential to run any commands. It won't even check another credential in the credential table.



Make sure you have marked Use MID Server service credential is true.



find_real_file.png



Regards,


Vivek



Based on the impact hit like, helpful or correct


brianhampson
Giga Contributor

We found a "solution"



The Orchestration MidServer Service was running as Local Service.   We set the login to the SVC.SnowOrc user and then we could access the share.



Seems like this is what all the Credentials should have done, but...   Live and learn I guess.