Another day, another hurdle. Yesterday's victory was short lived. I find that
EXEC xp_cmdshell 'net share ProgramdataXYZ=%ALLUSERSPROFILE%\XYZ /grant:everyone,FULL'
Works on one machine but not the other. After googling and checking out this and other forums, I am pretty sure I get why SQLserver A works but SQLserver B does not.
Test Machine A success
Test Machine B problems:
System error 5 has occurred.
Access is denied.
whoami
results from the SSMS execution of EXEC xp_cmdshell 'whoami'
:
test machine A's SQLserver:
nt authority\system
- works
test machine B's SQLserver:
nt authority\network service
- DOES NOT work
My QUESTION here is this:
Is there anything programmatically I can do about it? Can I write a script that ensures I execute XP_CMDSHELL
with the nt authority\system
account?
thanks in advance, Harry