Created
March 24, 2015 18:00
-
-
Save trekr5/5389bdaa3c5ffcf4e48f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def remove_login_rights(user) | |
| cookbook_file "ntrights.exe" do | |
| source "ntrights.exe" | |
| path "/windows/temp" | |
| mode '0644' | |
| action :create_if_missing | |
| notifies :run, 'execute[remove-right]', :immediately | |
| end | |
| execute "remove-right" do | |
| #cwd "C:\\windows\\temp" | |
| command "ntrights -u #{user} +r SeDenyInteractiveLogonRight" | |
| action :nothing | |
| end |
Author
def remove_login_rights(user)
cookbook_file "C:\Windows\Temp\ntrights.exe" do
source "ntrights.exe"
#path "C:\windows\temp"
mode '0644'
#verify File.exist?('ntrights.exe')
action :create_if_missing
notifies :run, 'execute[remove-right]', :immediately
end
execute "remove-right" do
#cwd "C:\\windows\\temp"
command "C:\\Windows\\Temp\\ntrights.exe -u #{user} +r SeDenyInteractiveLogonRight"
action :nothing
end
end
Something to keep in mind with a cookbook_file resource: the code under the hood in the cookbook_file provider handles the whole file already exists question.
Author
would it use powershell under the hood because the vagrant box i'm using is a windows 2012 server
Author
users_manage "sudo" do
data_bag "aws-admin-users"
group_id node.default['sudo_group_id']
action [:remove, :create]
end
Author
users_manage "sudo" do
data_bag "aws-admin-users"
group_id node.default['sudo_group_id']
action [:remove, :create]
end
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You could probably even omit the
action :create_if_missingfrom cookbook_file. The default action is:createwhich should handle your use case as I understand it.So ...