-
Notifications
You must be signed in to change notification settings - Fork 1
/
Chef_PowerShellCookbook.rb
40 lines (29 loc) · 1.22 KB
/
Chef_PowerShellCookbook.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# 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