Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Powershell & Psexec

$
0
0

Hi All,

So, I can get posh scripts to run off of .bat's, through psexec, as well as straight psexec from the command-line-- thing is, the scripts I've been running were one-liners and the one I'm trying to run now, is not

$inherit = [system.security.accesscontrol.InheritanceFlags]"ContainerInherit, ObjectInherit"
$propagation = [system.security.accesscontrol.PropagationFlags]"None"
$acl = Get-Acl HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies
$rule = New-Object System.Security.AccessControl.RegistryAccessRule ("euroinv.com\prizers","FullControl", $inherit, $propagation, "Allow")
$acl.SetAccessRule($rule)
$acl | Set-Acl -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies

That is the content of the .ps1 I'm trying to run. After running psexec \\YMIR cmd /c "echo . | Powershell.exe c:\windows\temp\DeploymentFiles\Set-UserACLReg.ps1"  as well as psexec \\YMIR -i cmd /c " Powershell.exe c:\windows\temp\DeploymentFiles\Set-UserACLReg.ps1" the script finishes, I don't get any errors, but the changes I'm looking for do not take. This commands do work on a local machine-- I've tested this already to ensure this.

Any help would be greatly appreciated!

Thanks!

- Sentri


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>