-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path55264ConfigAZVM.ps1
30 lines (29 loc) · 3.73 KB
/
55264ConfigAZVM.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
29
30
# Configure Remote Settings
Net LocalGroup "Remote Management Users" /Add Adminz
Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Force
Get-NetFirewallRule *WINRM* | Set-NetFirewallRule -Profile Any -RemoteAddress Any
Get-NetFirewallRule *RemoteDesktop* | Set-NetFirewallRule -Profile Any -RemoteAddress Any
# Get-NetConnectionProfile | Set-NetConnectionProfile -NetworkCategory Private
Enable-PSRemoting -SkipNetworkProfileCheck -Force
Set-WSManQuickConfig -Force
# Configure Lab Environment
New-Item -Path c:\labfiles.55264a -Type Directory -Force
New-Item -Path C:\Temp -Type Directory -Force
New-Item -Path C:\ConfigAZVM -Type Directory -Force
$SetupFile = "c:\labfiles.55264a\55264A-ENU_SetupFiles.zip"
$LabfilesFolder = "c:\labfiles.55264a\"
[Environment]::SetEnvironmentVariable("LABFILESFOLDER", $LabfilesFolder, "Machine")
[Environment]::SetEnvironmentVariable("WORKFOLDER", $LabfilesFolder, "Machine")
Set-PSRepository -Name PSGallery -InstallationPolicy Trusted
Expand-Archive -LiteralPath $SetupFile -DestinationPath $LabfilesFolder -Force
Get-ChildItem -Recurse $LabfilesFolder | Unblock-File
$SQLServerConfig = $LabfilesFolder + "SQLServerConfig.sql"
(Get-Content $SQLServerConfig) -Replace "vm55264srv",$env:COMPUTERNAME | Out-File -FilePath $SQLServerConfig
$RunCMD = $LabfilesFolder + "run.cmd"
(Get-Content $RunCMD) -Replace "vm55264srv",$env:COMPUTERNAME | Out-File -FilePath $RunCMD -Encoding ASCII
Enable-NetFirewallRule -DisplayName "File and Printer Sharing*"
# Get-DNSClient -InterfaceAlias Ethernet* | Set-DNSClient -ConnectionSpecificSuffix "contoso.com"
# Get-DNSClient -InterfaceAlias Ethernet* | Set-DNSClientServerAddress -ServerAddresses ("192.168.10.100","192.168.20.100")
reg import c:\labfiles.55264a\LocalLogonAdminz.reg
REG ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce /d c:\labfiles.55264a\run.cmd /f
shutdown /r /t 15