0

I would like to code the following :

In a windows server 2012-R2 administrator account, I have a my java application which launches an external application to run in a restricted user account. My java application also changes the user account windows permissions (read/write) as required.

1- Is it possible to launch an external application from a java processBuilder in one account and run the application in a different windows account?

2- Is it possible to change a windows server 2012-R2 users permission from java? only through a PS script?

Thanks

Guigui
  • 3
  • 1

1 Answers1

0

Launch an External Application

You can use ProcessBuilder to start a Process where PSExec is used to execute processes as a different user.

psexec.exe -u username -p password foo.exe

https://technet.microsoft.com/en-us/sysinternals/pxexec.aspx

Change a Windows Server 2012 R2 User's Permission

For executable file, you can use Icacls.

https://technet.microsoft.com/en-us/library/cc753525(v=ws.11).aspx

For PowerShell script, you can use Get-NTFSAccess, Add-NTFSAccess and Remove-NTFSAccess.

https://blogs.technet.microsoft.com/heyscriptingguy/2014/11/22/weekend-scripter-use-powershell-to-get-add-and-remove-ntfs-permissions/

Roger Ng
  • 116
  • 3