Posts Active Directory Lab Setup - (Mayor's Movement, Pivoting & Persistence Course Walkthrough)
Post
Cancel

Active Directory Lab Setup - (Mayor's Movement, Pivoting & Persistence Course Walkthrough)


Creating network

While in Virtual Box, hold Ctrl+G to launch Preference. Alternatively, you can click the File tab and select Preference.

image

Then click the Network tab and click the green icon with the + sign. You need to create three networks namely: external,internal & secure. In my case, here are the CIDR assigned to each. Also ensure that after creating each network, you enable it by clicking the checkbox.

Network NameCIDR
External192.168.20.0/24
Internal192.168.30.0/24
Secure192.168.40.0/24

image

Creating Virtual Machines

This segment is for people who might be new to creating Windows Virtual Machines. If you already know how to do this, you can skip to

Click on New icon

image

Name your Vitual Machine and select the type of Operating system and version of OS you wish to setup.

image

Allocate the RAM which will be used by the VM. (2GB is good for quick windows installation if you have minimal resources on your system)

image

Choose Create a virtual hard disk

image

Select a virtual disk image

image

Select a Dynamically allocated hard disk file

image

In this last step, you need to allocate the size of the hard disk the VM wil use. In this case, i’ll assign 50Gb to each machine.

image

Do the same for the second Workstation and the Windows Server. I find it a good practice to group my VM’s based on the lab exercise at hand. In this case, i’ve named my group Pivoting Lab. You can do so by right-clicking on a machine and click Group.

image

Os Installation

Boot the Windows Server and accept the EULA

image

Choose “Custom: Install Windows only (advanced)

image

Choose the drive and hit Next

image

After this step, the installation process begins. Once complete, you will be prompted to input the Administrators password. In this case and for lab purpose, we are gonna setup a “really secure passoword” of Password123! and hit next.

image

Once you login, you will be welcomed by the Server Manager Dashboard.

image

Upto this point, i think we are good to go. Lets proceed to Setup our Windows 10 Workstations.

Choose your region.

image

Select the keyboard layout that suits you.

image

For this lab setup, we’ll go with Set up for personal use

image

You will be promted to add your account. In the bottom left corner, choose an offline account.

image

For now, we’ll go with limited experience

image

Input a username for this PC

image

Enter a password.

image

Creds:

WorkstationUsernamePassword
1s.chisholmFallOutBoy1!
2m.seitzPhi11i35@44

The next step, you need to choose three security questions, so go ahead and do that.

image

For privacy settings, we can go ahead and disable all as we don’t really require them.

image

And with that done…both workstations should take a moment to load and start.

We also need to ensure that both workstations and the server have the same time settings. To do so, we can head over to Settings> Time & Language and ensure that you change the Time zone to match your current region.

image

Active Directory generation scripts

Before we can proceed setting up our DC, we need to create a snapshot of all VM’s. I find this a good practice incase the script doesn’t work as expected, or if it breaks the system, we can easily revert back to the initial state.

To create a snapshot, click the Machine tab and select Take Snapshot.

image

You will then be prompted to enter the snapshot name and a description which is optional.

image

Once done, click ok and the snapshot will be taken in a few minutes.

image

For the purpose of this course, rather than manually setting up the Domain Controller, we can use a set of Powershell scripts by TheMayor/Joe Helle which will create a vulnerable environment for us to pentest and learn a few concepts which i will be covering in te next series of blogs. You can download the scripts from this github repo: dievus/ADGenerator and follow along.

The first script we need to execute is Invoke-ForestDeploy.ps1

This will install the Windows Active Directory Domain Services toolset and generate the actual domain. Follow the instructions on screen, making note of the domain name used as this will be needed later. The scripts are hardcoded for mayorsec.local , and any deviation from that domain name will likely break the ADGenerator.ps1 functionality.

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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
PS C:\Users\Administrator\Desktop\ADGenerator-main> dir


    Directory: C:\Users\Administrator\Desktop\ADGenerator-main


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----         1/5/2022  12:17 AM                images
-a----         1/5/2022  12:17 AM          18405 ADGenerator.ps1
-a----         1/5/2022  12:17 AM           2034 coursewordlist
-a----         1/5/2022  12:17 AM           1912 Invoke-ForestDeploy.ps1
-a----         1/5/2022  12:17 AM            951 nameGen.ps1
-a----         1/5/2022  12:17 AM           1902 README.md


PS C:\Users\Administrator\Desktop\ADGenerator-main> Set-ExecutionPolicy Unrestricted

Execution Policy Change
The execution policy helps protect you from scripts that you do not trust. Changing the execution policy might expose you to the security risks described in the about_Execution_Policies help topic at
https:/go.microsoft.com/fwlink/?LinkID=135170. Do you want to change the execution policy?
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "N"): Y
PS C:\Users\Administrator\Desktop\ADGenerator-main> . .\Invoke-ForestDeploy.ps1

Security warning
Run only scripts that you trust. While scripts from the internet can be useful, this script can potentially harm your computer. If you trust this script, use the Unblock-File cmdlet to allow the script to run without this warning
message. Do you want to run C:\Users\Administrator\Desktop\ADGenerator-main\Invoke-ForestDeploy.ps1?
[D] Do not run  [R] Run once  [S] Suspend  [?] Help (default is "D"): R
PS C:\Users\Administrator\Desktop\ADGenerator-main> Invoke-ForestDeploy -DomainName mayorsec.local

             ______                     __        ____             __
            / ____/___  ________  _____/ /_      / __ \___  ____  / /___  __  __
           / /_  / __ \/ ___/ _ \/ ___/ __/_____/ / / / _ \/ __ \/ / __ \/ / / /
          / __/ / /_/ / /  /  __(__  ) /_/_____/ /_/ /  __/ /_/ / / /_/ / /_/ /
         /_/    \____/_/   \___/____/\__/     /_____/\___/ .___/_/\____/\__, /
                                                        /_/            /____/
        Domain Deployment Script by TheMayor

        [*] Installing Windows AD Domain Services Toolset. [*]

Success Restart Needed Exit Code      Feature Result
------- -------------- ---------      --------------
True    No             Success        {Active Directory Domain Services, Group P...


Toolset installed.


        [*] Generating the domain. Make note of the domain name for the ADGenerator Script to be ran after the controller is built. [*]
SafeModeAdministratorPassword: ************
Confirm SafeModeAdministratorPassword: ************

The target server will be configured as a domain controller and restarted when this operation is complete.
Do you want to continue with this operation?
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): Y
WARNING: Windows Server 2019 domain controllers have a default for the security setting named "Allow cryptography algorithms compatible with Windows NT 4.0" that prevents weaker cryptography algorithms when establishing security channel
 sessions.

For more information about this setting, see Knowledge Base article 942564 (http://go.microsoft.com/fwlink/?LinkId=104751).

WARNING: This computer has at least one physical network adapter that does not have static IP address(es) assigned to its IP Properties. If both IPv4 and IPv6 are enabled for a network adapter, both IPv4 and IPv6 static IP addresses
should be assigned to both IPv4 and IPv6 Properties of the physical network adapter. Such static IP address(es) assignment should be done to all the physical network adapters for reliable Domain Name System (DNS) operation.

WARNING: A delegation for this DNS server cannot be created because the authoritative parent zone cannot be found or it does not run Windows DNS server. If you are integrating with an existing DNS infrastructure, you should manually
create a delegation to this DNS server in the parent zone to ensure reliable name resolution from outside the domain "mayorsec.local". Otherwise, no action is required.

WARNING: Windows Server 2019 domain controllers have a default for the security setting named "Allow cryptography algorithms compatible with Windows NT 4.0" that prevents weaker cryptography algorithms when establishing security channel
 sessions.

For more information about this setting, see Knowledge Base article 942564 (http://go.microsoft.com/fwlink/?LinkId=104751).

WARNING: This computer has at least one physical network adapter that does not have static IP address(es) assigned to its IP Properties. If both IPv4 and IPv6 are enabled for a network adapter, both IPv4 and IPv6 static IP addresses
should be assigned to both IPv4 and IPv6 Properties of the physical network adapter. Such static IP address(es) assignment should be done to all the physical network adapters for reliable Domain Name System (DNS) operation.

WARNING: A delegation for this DNS server cannot be created because the authoritative parent zone cannot be found or it does not run Windows DNS server. If you are integrating with an existing DNS infrastructure, you should manually
create a delegation to this DNS server in the parent zone to ensure reliable name resolution from outside the domain "mayorsec.local". Otherwise, no action is required.


Message        : Operation completed successfully
Context        : DCPromo.General.3
RebootRequired : False
Status         : Success


Restart the controller if not instructed.

Don’t mind the warning messages. Once the Server restarts, you will notice that we are already in a domain called mayorsec

image

The next step is running the ADGenerator Script. Like we did in the previous step, you need to set the execution policy to unrestricted and invoke the ADGenerator script and run it with DomainName set to mayorsec.local.

But before executing the script, i browsed it to see what it does. Here are some of the stuff it does needed for the actual course.

  • Group generation - Senior Management, IT Admins, Engineering, Sales
  • Domain Information
  • Renaming the domain controller to DC01
  • Creates a new share called Shared
  • Creates and adds users to groups
  • Allow WinRM TCP 5985 To Domain Joined Systems
  • Configuring GPO policies to enable PowerShell remoting on hosts.
  • Creating ACL misconfigurations, Kerberoastable service, Administrative privilege delegation and modifying ASREP settings

Lets get into it

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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
PS C:\Users\Administrator\Desktop\ADGenerator-main> dir


    Directory: C:\Users\Administrator\Desktop\ADGenerator-main


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----         1/5/2022  12:17 AM                images
-a----         1/5/2022  12:17 AM          18405 ADGenerator.ps1
-a----         1/5/2022  12:17 AM           2034 coursewordlist
-a----         1/5/2022  12:17 AM           1912 Invoke-ForestDeploy.ps1
-a----         1/5/2022  12:17 AM            951 nameGen.ps1
-a----         1/5/2022  12:17 AM           1902 README.md


PS C:\Users\Administrator\Desktop\ADGenerator-main> Set-ExecutionPolicy Unrestricted

Execution Policy Change
The execution policy helps protect you from scripts that you do not trust. Changing the execution policy might expose you to the security risks described in the about_Execution_Policies help topic at
https:/go.microsoft.com/fwlink/?LinkID=135170. Do you want to change the execution policy?
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "N"): Y
PS C:\Users\Administrator\Desktop\ADGenerator-main> . .\ADGenerator.ps1

Security warning
Run only scripts that you trust. While scripts from the internet can be useful, this script can potentially harm your computer. If you trust this script, use the Unblock-File cmdlet to allow the script to run without this warning
message. Do you want to run C:\Users\Administrator\Desktop\ADGenerator-main\ADGenerator.ps1?
[D] Do not run  [R] Run once  [S] Suspend  [?] Help (default is "D"): R
PS C:\Users\Administrator\Desktop\ADGenerator-main> Invoke-ADGenerator -DomainName mayorsec.local

            ___    ____     ______                           __
           /   |  / __ \   / ____/__  ____  ___  _________ _/ /_____  _____
          / /| | / / / /  / / __/ _ \/ __ \/ _ \/ ___/ __ `/ __/ __ \/ ___/
         / ___ |/ /_/ /  / /_/ /  __/ / / /  __/ /  / /_/ / /_/ /_/ / /
        /_/  |_/_____/   \____/\___/_/ /_/\___/_/   \__,_/\__/\____/_/
        Vulnerable Active Directory Domain Generator by The Mayor

        [*] Promoting Administrator to appropriate Domain Administrative roles required for the course. [*]
        [+] Promoting Administrator to Enterprise Administrator.
User Administrator is already a member of group Enterprise Admins.

More help is available by typing NET HELPMSG 3754.

        [+] Promoting Administrator to Domain Administrator.
User Administrator is already a member of group Domain Admins.

More help is available by typing NET HELPMSG 3754.

        [+] Promoting Administrator to Group Policy Creator Owners.
User Administrator is already a member of group Group Policy Creator Owners.

More help is available by typing NET HELPMSG 3754.

        [+] Promoting Administrator to Local Administrator (error output may occur - this is expected).
System error 1378 has occurred.

The specified account name is already a member of the group.

        [*] Administrative privilege delegation completed. [*]
        [*] Renaming the domain controller to DC01 [*]
WARNING: The changes will take effect after you restart the computer WIN-SOKFK09IVBB.


    Directory: C:\


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----         1/5/2022   4:05 AM                Shared

AvailabilityType      : NonClustered
CachingMode           : Manual
CATimeout             : 0
ConcurrentUserLimit   : 0
ContinuouslyAvailable : False
CurrentUsers          : 0
Description           :
EncryptData           : False
FolderEnumerationMode : Unrestricted
IdentityRemoting      : False
Infrastructure        : False
LeasingMode           : Full
Name                  : Shared
Path                  : C:\Shared
Scoped                : False
ScopeName             : *
SecurityDescriptor    : O:SYG:SYD:(A;;0x1200a9;;;BU)
ShadowCopy            : False
ShareState            : Online
ShareType             : FileSystemDirectory
SmbInstance           : Default
Special               : False
Temporary             : False
Volume                : \\?\Volume{8bba7c49-0000-0000-0000-602200000000}\
PSComputerName        :
PresetPathAcl         : System.Security.AccessControl.DirectorySecurity

        [*] Domain controller renamed. [*]
        [*] Creating Domain Groups [*]
                [+] Adding Senior Management to mayorsec.local
        [+] Adding IT Admins to mayorsec.local
        [+] Adding Engineering to mayorsec.local
        [+] Adding Sales to mayorsec.local
        [*] Generating Organizational Units for the mayorsec.local. [*]
        [+] Organizational Units added.
        [*] Group creation completed. [*]
        [*] Creating Domain Users [*]
        [+] a.adams added
        [+] Adding a.adams to Senior Management Group
        [+] Adding a.adams to Domain Administrators Group
        [+] j.taylor added
        [+] Adding j.taylor to IT Admins Group
        [+] j.anthony added
        [+] Adding j.anthony to Engineering Group
        [+] t.carter added
        [+] Adding t.carter to Engineering Group
        [+] m.phillips added
        [+] Adding m.phillips to Engineering Group
        [+] r.smith added
        [+] Adding r.smith to Engineering Group
        [+] s.chisholm added
        [+] Adding s.chisholm to Sales
        [+] m.seitz added
        [+] Adding m.seitz to Engineering Group
        [+] a.tarolli added
        [+] Adding a.tarolli to Sales
        [+] z.dickens added
        [+] Adding z.dickens to Sales
        [*] User creation completed [*]
        [*] Modifying pre-authentication privileges [*]
        [+] ASREP privileges granted to a.tarolli
        [*] ASREP settings update completed. [*]
        [*] Adding Kerberoastable service account to domain [*]
The command completed successfully.

Checking domain DC=mayorsec,DC=local

Registering ServicePrincipalNames for CN=mssql_svc,CN=Users,DC=mayorsec,DC=local
        DC01/mssql_svc.
Updated object
        [+] mssql_svc service account added
        [*] Kerberoastable service creation completed. [*]
        [*] Granting IT Admins GenericAll rights on Domain Admins. [*]
        [+] IT Admins group granted GenericAll permissions for the Domain Admins group.
        [*] Adding misconfigured ACL rule for the Engineering group. [*]
        [+] Whoops! GenericAll rights granted to Engineering.
        [*] Adding misconfigured ACL rule for Margaret Seitz. [*]
        [+] Whoops! GenericAll rights granted to m.seitz.
        [*] Adding misconfigured ACL rule for the Sales group. [*]
        [+] Whoops! GenericAll rights granted to Sales.
        [*] ACL misconfigurations completed. [*]
        [*] Configuring some GPO policies required for the domain. [*]

DisplayName   : WinRM Firewall TCP 5985
GpoId         : fac02e0a-d68e-4d10-979b-16a5f9db31ef
Enabled       : True
Enforced      : False
Order         : 2
Target        : DC=mayorsec,DC=local
GpoDomainName : mayorsec.local


Caption                 :
Description             :
ElementName             : Allow WinRM TCP 5985 To Domain Joined Systems
InstanceID              : {1fe11ce5-117b-48a1-bf7b-116c874d20e9}
CommonName              :
PolicyKeywords          :
Enabled                 : True
PolicyDecisionStrategy  : 2
PolicyRoles             :
ConditionListType       : 3
CreationClassName       : MSFT|FW|FirewallRule|{1fe11ce5-117b-48a1-bf7b-116c874d20e9}
ExecutionStrategy       : 2
Mandatory               :
PolicyRuleName          :
Priority                :
RuleUsage               :
SequencedActions        : 3
SystemCreationClassName :
SystemName              :
Action                  : Allow
Direction               : Inbound
DisplayGroup            :
DisplayName             : Allow WinRM TCP 5985 To Domain Joined Systems
EdgeTraversalPolicy     : Block
EnforcementStatus       : NotApplicable
LocalOnlyMapping        : False
LooseSourceMapping      : False
Owner                   :
Platforms               : {}
PolicyStoreSource       :
PolicyStoreSourceType   : GroupPolicy
PrimaryStatus           : OK
Profiles                : 0
RuleGroup               :
Status                  : The rule was parsed successfully from the store. (65536)
StatusCode              : 65536
PSComputerName          :
Name                    : {1fe11ce5-117b-48a1-bf7b-116c874d20e9}
ID                      : {1fe11ce5-117b-48a1-bf7b-116c874d20e9}
Group                   :
Profile                 : Any
Platform                : {}
LSM                     : False

        [+] A GPO for PowerShell Remoting was created for authenticated users on the domain.
        [*] GPO configurations completed. [*]
        [*] Configuring GPO policies to enable PowerShell remoting on hosts. [*]

DisplayName   : Enable PSRemoting Desktops
GpoId         : 6bc94864-cd95-44ea-9459-e050214175ad
Enabled       : True
Enforced      : False
Order         : 3
Target        : DC=mayorsec,DC=local
GpoDomainName : mayorsec.local


Id               : 6bc94864-cd95-44ea-9459-e050214175ad
DisplayName      : Enable PSRemoting Desktops
Path             : cn={6BC94864-CD95-44EA-9459-E050214175AD},cn=policies,cn=system,DC=mayorsec,DC=local
Owner            : mayorsec\Domain Admins
DomainName       : mayorsec.local
CreationTime     : 1/5/2022 4:06:43 AM
ModificationTime : 1/5/2022 4:06:44 AM
User             : Microsoft.GroupPolicy.UserConfiguration
Computer         : Microsoft.GroupPolicy.ComputerConfiguration
GpoStatus        : AllSettingsEnabled
WmiFilter        :
Description      :


Id               : 6bc94864-cd95-44ea-9459-e050214175ad
DisplayName      : Enable PSRemoting Desktops
Path             : cn={6BC94864-CD95-44EA-9459-E050214175AD},cn=policies,cn=system,DC=mayorsec,DC=local
Owner            : mayorsec\Domain Admins
DomainName       : mayorsec.local
CreationTime     : 1/5/2022 4:06:43 AM
ModificationTime : 1/5/2022 4:06:44 AM
User             : Microsoft.GroupPolicy.UserConfiguration
Computer         : Microsoft.GroupPolicy.ComputerConfiguration
GpoStatus        : AllSettingsEnabled
WmiFilter        :
Description      :


Id               : 6bc94864-cd95-44ea-9459-e050214175ad
DisplayName      : Enable PSRemoting Desktops
Path             : cn={6BC94864-CD95-44EA-9459-E050214175AD},cn=policies,cn=system,DC=mayorsec,DC=local
Owner            : mayorsec\Domain Admins
DomainName       : mayorsec.local
CreationTime     : 1/5/2022 4:06:43 AM
ModificationTime : 1/5/2022 4:06:44 AM
User             : Microsoft.GroupPolicy.UserConfiguration
Computer         : Microsoft.GroupPolicy.ComputerConfiguration
GpoStatus        : AllSettingsEnabled
WmiFilter        :
Description      :

        [+] Registry setting for Powershell Remoting OK!

Id               : 6bc94864-cd95-44ea-9459-e050214175ad
DisplayName      : Enable PSRemoting Desktops
Path             : cn={6BC94864-CD95-44EA-9459-E050214175AD},cn=policies,cn=system,DC=mayorsec,DC=local
Owner            : mayorsec\Domain Admins
DomainName       : mayorsec.local
CreationTime     : 1/5/2022 4:06:43 AM
ModificationTime : 1/5/2022 4:06:44 AM
User             : Microsoft.GroupPolicy.UserConfiguration
Computer         : Microsoft.GroupPolicy.ComputerConfiguration
GpoStatus        : AllSettingsEnabled
WmiFilter        :
Description      :


Id               : 6bc94864-cd95-44ea-9459-e050214175ad
DisplayName      : Enable PSRemoting Desktops
Path             : cn={6BC94864-CD95-44EA-9459-E050214175AD},cn=policies,cn=system,DC=mayorsec,DC=local
Owner            : mayorsec\Domain Admins
DomainName       : mayorsec.local
CreationTime     : 1/5/2022 4:06:43 AM
ModificationTime : 1/5/2022 4:06:46 AM
User             : Microsoft.GroupPolicy.UserConfiguration
Computer         : Microsoft.GroupPolicy.ComputerConfiguration
GpoStatus        : AllSettingsEnabled
WmiFilter        :
Description      :

        [+] Service setting for Powershell Remoting OK!
        [*] Domain-wide PowerShell Remoting GPO configuration completed. [*]
        [*] Some changes require a restart to take effect. Restarting your domain controller in 30 seconds. [*]

image

Joining Domains

Starting with the DC, since its on the Secure Network, we can give it a static ip of 192.168.40.50. To do this, we need to go to Control Panel > Network and Internet > Network and Sharing Center

Head over to Setting > Accounts > Access work or school and click on connect

image

In our scenario, we want to join a local Active Directory Domain

image

Add the domain to join (mayorsec.local)

image

You will be promted to input a user and their password.

image

Make sure you choose Administrator

image

Once the machine reboots, you’ll notice we are now part of the domain.

image

Repeat this procedure with Workstation2.

If we now go back to our server , launch server manager and on the top right corner, click Tools and select Active Directory Users and Computers

image

If we click on the Computers tab, we should be able to find both machines listed.

image

This names make it hard to identify a specific computer. We can go ahead an use a script called nameGen to automatically rename the PC’s. This has to be executed on both machines though. Here is how you would go about it.

image

We find 3 folders. We are particularly interested in Shared

image

If we navigate further, we can get the script and drag it to our desktop

image

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
PS C:\Users\s.chisholm.mayorsec\Desktop> dir


    Directory: C:\Users\s.chisholm.mayorsec\Desktop


Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a----         9/23/2021   1:06 PM            951 nameGen.ps1


PS C:\Users\s.chisholm.mayorsec\Desktop> Set-ExecutionPolicy Unrestricted

Execution Policy Change
The execution policy helps protect you from scripts that you do not trust. Changing the execution policy might expose you to the security risks described in the about_Execution_Policies help topic at
https:/go.microsoft.com/fwlink/?LinkID=135170. Do you want to change the execution policy?
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "N"): Y
PS C:\Users\s.chisholm.mayorsec\Desktop> . .\nameGen.ps1
PS C:\Users\s.chisholm.mayorsec\Desktop> executeScript -ComputerName WORKSTATION-02
WARNING: The changes will take effect after you restart the computer DESKTOP-C4EGH78.


    Directory: C:\


Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d-----          1/6/2022  10:55 AM                Shared
AvailabilityType      : NonClustered
CachingMode           : Manual
CATimeout             : 0
ConcurrentUserLimit   : 0
ContinuouslyAvailable : False
CurrentUsers          : 0
Description           :
EncryptData           : False
FolderEnumerationMode : Unrestricted
IdentityRemoting      : False
Infrastructure        : False
LeasingMode           : Full
Name                  : Shared
Path                  : C:\Shared
Scoped                : False
ScopeName             : *
SecurityDescriptor    : O:SYG:SYD:(A;;FA;;;BU)
ShadowCopy            : False
ShareState            : Online
ShareType             : FileSystemDirectory
SmbInstance           : Default
Special               : False
Temporary             : False
Volume                : \\?\Volume{dc62328a-0000-0000-0000-300300000000}\
PSComputerName        :
PresetPathAcl         : System.Security.AccessControl.DirectorySecurity

image

Resources

This post is licensed under CC BY 4.0 by the author.