-
-
Notifications
You must be signed in to change notification settings - Fork 83
/
NameGen.ps1
28 lines (24 loc) · 951 Bytes
/
NameGen.ps1
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
# This PS1 script is used to generate the appropriate name for your workstations, i.e. Workstation-01 or Workstation-02. Not for use on your Domain Controller.
# Run this script from an elevated command prompt and enter your credentials when prompted. The computer will be renamed at the DC and a file share will be
# generated on the Workstation created for you to use across the exercises.
function renamePC {
$username = whoami
Rename-computer -NewName $ComputerName -DomainCredential $username
}
function Share {
mkdir C:\Shared; new-smbshare -Name "Shared" -Path "C:\Shared" -FullAccess "Users"
}
function enableRDPRemoting {
Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server' -name "fDenyTSConnections" -value 0
Enable-NetFirewallRule -DisplayGroup "Remote Desktop"
}
function executeScript {
Param(
[Parameter(Mandatory=$True)]
[ValidateNotNullOrEmpty()]
[System.String]
$ComputerName
)
renamePC
Share
}