-
Notifications
You must be signed in to change notification settings - Fork 1
/
ad-join.yml
66 lines (55 loc) · 2.44 KB
/
ad-join.yml
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
---
- name: Guest Creation
gather_facts: no
vars_files:
- vcenter_vars.yml
hosts: localhost
tasks:
- name: Execute Security Powershell - test
vmware_vm_shell:
hostname: "{{ vcenter_server }}"
username: [email protected]
password: "{{ vcenter_pass }}"
validate_certs: false
datacenter: "{{ datacenter_2 }}"
vm_id: "{{ vm_name }}"
vm_username: Administrator
vm_password: "{{ vmwin_adminpassword }}"
vm_shell: 'c:\windows\system32\windowspowershell\v1.0\powershell.exe'
vm_shell_args: "{{ item }}"
with_items:
- '-command "& {Set-ExecutionPolicy Unrestricted}"'
- '-command "& {Invoke-Expression ((New-Object System.Net.Webclient).DownloadString(\"http://168.1.95.186/powershell/test.ps1\"))}"'
- '-command "& {Set-ExecutionPolicy RemoteSigned}"'
- name: Execute Security Powershell - awesome if it works
vmware_vm_shell:
hostname: "{{ vcenter_server }}"
username: [email protected]
password: "{{ vcenter_pass }}"
validate_certs: false
datacenter: "{{ datacenter_2 }}"
vm_id: "{{ vm_name }}"
vm_username: Administrator
vm_password: "{{ vmwin_adminpassword }}"
vm_shell: 'c:\windows\system32\windowspowershell\v1.0\powershell.exe'
vm_shell_args: "{{ item }}"
with_items:
- '-command "& {Set-ExecutionPolicy Unrestricted}"'
- '-command "& {Invoke-Expression ((New-Object System.Net.Webclient).DownloadString(\"http://168.1.95.186/powershell/call.ps1\"))}"'
- '-command "& {Set-ExecutionPolicy RemoteSigned}"'
- name: Execute Security Powershell-1
vmware_vm_shell:
hostname: "{{ vcenter_server }}"
username: [email protected]
password: "{{ vcenter_pass }}"
validate_certs: false
datacenter: "{{ datacenter_2 }}"
vm_id: "{{ vm_name }}"
vm_username: Administrator
vm_password: "{{ vmwin_adminpassword }}"
vm_shell: 'c:\windows\system32\windowspowershell\v1.0\powershell.exe'
vm_shell_args: "{{ item }}"
with_items:
- '-command "& {Set-ExecutionPolicy Unrestricted}"'
# - '-command "& {Invoke-WebRequest "http://168.1.95.186/powershell/5g.bat" -OutFile "C:\5g.bat"))}"'
# - '-command "& {Set-ExecutionPolicy RemoteSigned}"'