Skip to content

Instantly share code, notes, and snippets.

@guitarrapc
Created December 6, 2014 20:31
Show Gist options
  • Save guitarrapc/7a7f38a5b63ddc28dff9 to your computer and use it in GitHub Desktop.
Save guitarrapc/7a7f38a5b63ddc28dff9 to your computer and use it in GitHub Desktop.
# Do you think is work? NO........
powershell_script "executionpolicy" do
code 'Set-ExecutionPolicy RemoteSigned'
not_if "(Get-ExecutionPolicy -Scope LocalMachine) -eq 'RemoteSiggned'"
end
powershell_script "smbsharelogs" do
code 'New-SMBShare logshare C:\logs'
not_if 'Get-SMBShare logshare'
end
# To work with x64..... awful
powershell_script "executionpolicy" do
code 'Set-ExecutionPolicy RemoteSigned'
not_if "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -noprofile -executionpolicy bypass -command ((Get-ExecutionPolicy -Scope LocalMachine) -eq 'RemoteSiggned')"
end
powershell_script "smbsharelogs" do
code 'New-SMBShare logshare C:\logs'
not_if "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -noprofile -executionpolicy bypass -command (Get-SMBShare logshare)"
end
# using guard Interpreter to make it in x64
powershell_script "executionpolicy" do
guitad_interpreter :powershell_script
code 'Set-ExecutionPolicy RemoteSigned'
not_if "(Get-ExecutionPolicy -Scope LocalMachine) -eq 'RemoteSiggned'"
end
powershell_script "smbsharelogs" do
guitad_interpreter :powershell_script
code 'New-SMBShare logshare C:\logs'
not_if 'Get-SMBShare logshare'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment