search
Categories
Archive
Blogroll

Badges

Microsoft PowerShell MVP
MCSE
Sponsors

VirtualMetric
Cozumpark Bilisim Portali
Checklist automation after Hyper-V 2012 installation
Posted in Windows Powershell, Windows Server | No Comment | 349 views | 06/09/2013 09:26

This is my automation script after Hyper-V 2012 installation.

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
# Disable Firewall
netsh advfirewall set allprofiles state off
 
# Disable UAC
Function Test-RegistryValue 
{
    param(
        [Alias("RegistryPath")]
        [Parameter(Position = 0)]
        [String]$Path
        ,
        [Alias("KeyName")]
        [Parameter(Position = 1)]
        [String]$Name
    )
 
    process 
    {
        if (Test-Path $Path) 
        {
            $Key = Get-Item -LiteralPath $Path
            if ($Key.GetValue($Name, $null) -ne $null)
            {
                if ($PassThru)
                {
                    Get-ItemProperty $Path $Name
                }       
                else
                {
                    $true
                }
            }
            else
            {
                $false
            }
        }
        else
        {
            $false
        }
    }
}
 
Function Disable-UAC
{
    $EnableUACRegistryPath = "REGISTRY::HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System"
    $EnableUACRegistryKeyName = "EnableLUA"
    $UACKeyExists = Test-RegistryValue -RegistryPath $EnableUACRegistryPath -KeyName $EnableUACRegistryKeyName 
    if ($UACKeyExists)
    {
        Set-ItemProperty -Path $EnableUACRegistryPath -Name $EnableUACRegistryKeyName -Value 0
    }
    else
    {
        New-ItemProperty -Path $EnableUACRegistryPath -Name $EnableUACRegistryKeyName -Value 0 -PropertyType "DWord"
    }
}
Disable-UAC
 
# Disable IEESC
function Disable-IEESC
{
	$AdminKey = “HKLM:\SOFTWARE\Microsoft\Active Setup\Installed Components\{A509B1A7-37EF-4b3f-8CFC-4F3A74704073}$UserKey = “HKLM:\SOFTWARE\Microsoft\Active Setup\Installed Components\{A509B1A8-37EF-4b3f-8CFC-4F3A74704073}Set-ItemProperty -Path $AdminKey -Name “IsInstalled” -Value 0
	Set-ItemProperty -Path $UserKey -Name “IsInstalled” -Value 0
	Stop-Process -Name Explorer -Force
	Write-Host “IE Enhanced Security Configuration (ESC) has been disabled.” -ForegroundColor Green
}
Disable-IEESC
 
# Change Power Plan
function SetPowerPlan
{
    $PreferredPlan = "High performance"
    Write-Host "Setting Powerplan to $PreferredPlan" 
    $guid = (Get-WmiObject -Class win32_powerplan -Namespace root\cimv2\power -Filter "ElementName='$PreferredPlan'").InstanceID.tostring() 
    $regex = [regex]"{(.*?)}$" 
    $newpowerVal = $regex.Match($guid).groups[1].value
 
    # setting power setting to high performance 
    powercfg -S  $newpowerVal 
}
SetPowerPlan
 
# 3Par Command
fsutil behavior set disabledeletenotify 1
 
# Set Culture Configuration
Set-Culture tr-TR
Set-WinSystemLocale tr-TR
 
# Install Features
Copy-Item -Path "\\CLOUDLIB01\C$\SxS" -Destination "C:\SxS" -Recurse
Install-WindowsFeature -ConfigurationFilePath \\CLOUDLIB01\C$\Template\DeploymentConfigTemplate.xml -Source "C:\SxS"
 
# Install OV Client
Copy-Item -Path "\\CLOUDLIB01\C$\OV_x86x64" -Destination "C:\OV_x86x64" -Recurse
cd "C:\OV_x86x64"
.\setup.bat

You can create your own DeploymentConfigTemplate via Server Manager. You just need to export config.



Leave a Reply