bstillion
asked on
Converting command line syntax to VBScript for NTFS permissions
Thanks to this forum, I now have the working syntax to uncheck the "inherit permissions from parent folder" with VBScript syntax:
Set WshShell = WScript.CreateObject("WScr ipt.Shell" )
WshShell.run "cscript c:\winnt\xcacls.vbs \\oak\users$\TEST /I remove /q /L c:\xlog.txt",10,true
I now need to incorporate this into the Createusers.vbs script. The relevant section is below:
If objFSO.FolderExists(strHom eFolder) Then
' Assign user permission to home folder.
intRunError = objShell.Run("%COMSPEC% /c Echo Y| cacls " _
& strHomeFolder & " /T /E /C /G " & strNetBIOSDomain _
& "\" & strNTName & ":C", 2, True)
If intRunError <> 0 Then
Wscript.Echo "Error assigning permissions for user " _
& strNTName & " to home folder " & strHomeFolder
End If
End If
I believe I should put the code to "uncheck the inherit box" as the first line and then alter
this to assign permissions in accordance with our current network policy which are:
administrators (local) F
SYSTEM: F
<strNTName>: M
How would I alter that seciton of code to:
1) use the variables to uncheck the "inherit" box
2) use variables to then assign the necessary permissionis
I have googled this to death and tried various combinations but due to a lack of
background in VBScript, am not yet fluent with the basics. Any assistance is
greatly appreciated as this is the final step to automating user account creation.
Attached is the entire Createusers.vbs that works up to this point.
Thanks.
Createusers.txt
Set WshShell = WScript.CreateObject("WScr
WshShell.run "cscript c:\winnt\xcacls.vbs \\oak\users$\TEST /I remove /q /L c:\xlog.txt",10,true
I now need to incorporate this into the Createusers.vbs script. The relevant section is below:
If objFSO.FolderExists(strHom
' Assign user permission to home folder.
intRunError = objShell.Run("%COMSPEC% /c Echo Y| cacls " _
& strHomeFolder & " /T /E /C /G " & strNetBIOSDomain _
& "\" & strNTName & ":C", 2, True)
If intRunError <> 0 Then
Wscript.Echo "Error assigning permissions for user " _
& strNTName & " to home folder " & strHomeFolder
End If
End If
I believe I should put the code to "uncheck the inherit box" as the first line and then alter
this to assign permissions in accordance with our current network policy which are:
administrators (local) F
SYSTEM: F
<strNTName>: M
How would I alter that seciton of code to:
1) use the variables to uncheck the "inherit" box
2) use variables to then assign the necessary permissionis
I have googled this to death and tried various combinations but due to a lack of
background in VBScript, am not yet fluent with the basics. Any assistance is
greatly appreciated as this is the final step to automating user account creation.
Attached is the entire Createusers.vbs that works up to this point.
Thanks.
Createusers.txt
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
Rob,
Thanks for the explanation.
I can certainly simplify my questions (which helps me as well.)
I will work with your suggestions now.
Thanks you also for your help.
Brad
Thanks for the explanation.
I can certainly simplify my questions (which helps me as well.)
I will work with your suggestions now.
Thanks you also for your help.
Brad
ASKER
Rob,
Here's the vbscript syntax that worked for me to uncheck the "inherit permissions from parent folder":
If objFSO.FolderExists(strHom eFolder) Then
set objWsh = CreateObject("Wscript.Shel l")
objWsh.run "c:\WINNT\xcacls.vbs \\oak\Users$\" & strNTName & " /I remove"
End If
strHomeFolder is designated in an excel spreadsheet and pulled into this larger script
which is free from the Win200X server resource kit called Createusers.vbs script
\\oak\users$ is the server and folder where all user home folders reside
xcacls.vbs (available free from Microsoft) is needed to "uncheck" the box-cacls cannot do it.
Thanks again for your help
Brad
Here's the vbscript syntax that worked for me to uncheck the "inherit permissions from parent folder":
If objFSO.FolderExists(strHom
set objWsh = CreateObject("Wscript.Shel
objWsh.run "c:\WINNT\xcacls.vbs \\oak\Users$\" & strNTName & " /I remove"
End If
strHomeFolder is designated in an excel spreadsheet and pulled into this larger script
which is free from the Win200X server resource kit called Createusers.vbs script
\\oak\users$ is the server and folder where all user home folders reside
xcacls.vbs (available free from Microsoft) is needed to "uncheck" the box-cacls cannot do it.
Thanks again for your help
Brad
ASKER
Rob,
Thanks for the help. I tweaked and posted my final working syntax but your help was very useful.
Brad
Thanks for the help. I tweaked and posted my final working syntax but your help was very useful.
Brad
Great work Brad, thanks for the info....and the grade.
Regards,
Rob.
Regards,
Rob.
ASKER
My guess is that the point total is too low to be attractive.
Other possible reasons no one has replied:
The answer is too obvious
Can anyone comment on what I can improve in future questions?
Thanks in advance.
Brad