I frequently have to create Directories and set permissions on Samba-Shares which are joined to foreign Domains without Trust Relationship to my "home" Domain.
Mounting and creating Directories works fine
New-PSDrive -Name "F" -PSProvider FileSystem -Root $someNAS -Persist -Credential $admin_in_foreign_domain
New-Item -Path "F:\a\b\testdir" -ItemType Directory
but changing Permissions on that newly created Folder fails.
icacls.exe "F:\a\b\testdir" /inheritance:r /grant "$($foreign_domain)\$($some_username):(OI)(CI)(RX,W)"
results in
domain\User The Trust Relationship Between This Workstation and the Primary Domain Failed
using Powershell Get/Set-ACL didn´t even work within our own Domain. This is probably a Samba issue (didn´t test further).
Any idea how to get around this without using domain-joined computers?
Thanks in Advance