Powershell & Psexec
hi all,
so, can posh scripts run off of .bat's, through psexec, straight psexec command-line-- thing is, scripts i've been running one-liners , 1 i'm trying run now, 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 content of .ps1 i'm trying run. after running psexec \\ymir cmd /c "echo . | powershell.exe c:\windows\temp\deploymentfiles\set-useraclreg.ps1" as psexec \\ymir -i cmd /c " powershell.exe c:\windows\temp\deploymentfiles\set-useraclreg.ps1" script finishes, don't errors, changes i'm looking not take. commands work on local machine-- i've tested ensure this.
any appreciated!
thanks!
- sentri
Windows Server > Windows PowerShell
Comments
Post a Comment