Last active
January 27, 2016 04:26
-
-
Save heri16/865d4d9ae1f61a248d9e to your computer and use it in GitHub Desktop.
SoftwareUpgradeNasional
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 0. Hanya untuk Win7, buka "Network and Sharing Center", dan pastikan semua koneksi tipe nya sudah di set ke "Work/Home" bukan Public. | |
# 1. Masuk ke Powershell Administrator. | |
# 2. Pilih sebuah password yang minim ada huruf besar dan simbol, dan edit di bagian $password | |
# 4. Copy-Paste seluruh script ini ke dalam Powershell Administrator. | |
# Pilih sebuah password yang minim ada huruf besar dan simbol, dan edit variable tersebut (sebelum di execute di shell): | |
$password = 'P@sswordPilihanNyaCabangMasing2' | |
clear | |
### Untuk Semua PC ### | |
# Create/edit windows user IT di ADSI: | |
if ([ADSI]::Exists("WinNT://./IT")) { | |
$user = [ADSI]"WinNT://./IT,user" | |
} else { | |
$computer = [ADSI]"WinNT://$Env:computername,computer" | |
$user = $computer.Create("user", "IT") | |
} | |
$user.SetPassword($password) | |
$user.SetInfo() | |
$user.Description = "Administrator IT" | |
$user.SetInfo() | |
$user.UserFlags = 65536 # Password never expires | |
$user.SetInfo() | |
$group = [ADSI]("WinNT://./Administrators,group") | |
$group.add("WinNT://IT,user") | |
# NET USER IT "$password" /ADD | |
# NET LOCALGROUP "Administrators" "IT" /add | |
# Disable remote UAC di Registry: | |
New-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" -Name " LocalAccountTokenFilterPolicy" -Value 1 -PropertyType "DWORD" | |
# Enable Windows Powershell Remoting: | |
if ([Environment]::OSVersion.Version -ge (new-object 'Version' 6,2)) { | |
### Hanya untuk Win8+ ### | |
Write-Output "Windows 8 and above" | |
Set-NetConnectionProfile -NetworkCategory Private | |
Enable-PSRemoting -force # Enable Powershell remoting | |
if ($PSVersionTable.PSVersion.Major >=3) { Enable-PSRemoting -SkipNetworkProfileCheck -force } | |
Set-NetConnectionProfile -NetworkCategory Public | |
Set-NetConnectionProfile -NetworkCategory Private -InterfaceAlias ("Ethernet 2", "Ethernet 3") | |
# Pilih "Yes" jika ada popup muncul. | |
} else { | |
### Hanya untuk Win7 ### | |
Write-Output "Windows 7 and below" | |
C:\ProgramData\ZeroTier\One\zerotier-one_x*.exe -q leave 692cb81394000001 | |
$ztLastExitCode = $LastExitCode | |
Try | |
{ | |
Enable-PSRemoting -force | |
} | |
Catch | |
{ | |
Start-Process powershell.exe -Verb runAs -ArgumentList ("-Command", "Enable-PSRemoting") -Wait | |
[System.Reflection.Assembly]::LoadWithPartialName(“System.Windows.Forms”) | Out-Null | |
$result = [System.Windows.Forms.MessageBox]::Show(“Error. Harap login ke desktop user IT dan coba kembali.”, ”Activation Error”, “YesNo” , “Error” , “Button1”) | |
if ($result -eq "Yes") { logoff } | |
} | |
if ($ztLastExitCode -eq 0) { Start-Sleep -s 10; C:\ProgramData\ZeroTier\One\zerotier-one_x*.exe -q join 692cb81394000001 } | |
# Pilih "Work" saat popup muncul. | |
} | |
# Catatan: | |
# Hanya untuk Win7, sebelum menjalankan scrpt, harap buka "Network and Sharing Center", | |
# - dan pastikan semua koneksi tipe nya sudah di set ke "Work/Home" bukan Public. | |
# Jika Popup "new network connection" muncul, pilih work untuk Win7, dan pilih Yes untuk Win8+ . | |
# Setelah menjalankan script ini, Pastikan setiap komputer sudah muncul user windows yang username nya "IT". | |
# Untuk password windows user "IT", di sarankan semuanya dibuat sama di dalam satu cabang, tetapi berdedah antar-cabang. | |
# Username "IT" khusus untuk software monitoring/update. Untuk user yang perlu akses ke admin rights, buatkan username terpisah. | |
# Setelah selesai, Telepon ke Tim IT Pusat untuk serahkan password nya untuk didaftarkan ke Software Monitoring Windows. | |
# Tujuan proyek ini biar bisa otomatis dilakukan upgrade saat ada versi software baru atau konfigurasi server baru. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$wc = New-Object System.Net.WebClient | |
$wc.DownloadFile("https://download.zerotier.com/dist/ZeroTier%20One.msi", "C:\ProgramData\ZeroTier\ZeroTier One.msi") | |
Start-Process "C:\ProgramData\ZeroTier\ZeroTier One.msi" /qn -Wait | |
& { | |
C:\ProgramData\ZeroTier\One\zerotier-one_x*.exe -q leave 692cb81394000001 | |
if ($LastExitCode -eq 0) { | |
Start-Sleep -s 10 | |
C:\ProgramData\ZeroTier\One\zerotier-one_x*.exe -q join 692cb81394000001 | |
Start-Sleep -s 10 | |
} | |
} | |
#C:\ProgramData\ZeroTier\One\zerotier-one_x*.exe -q listpeers | |
C:\ProgramData\ZeroTier\One\zerotier-one_x*.exe -q listnetworks | |
C:\ProgramData\ZeroTier\One\zerotier-one_x*.exe -q info |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
netsh interface teredo set state disabled | |
netsh interface ipv6 show interface | |
[Environment]::SetEnvironmentVariable("SAP_IPv6_ACTIVE", "1", "Machine") | |
New-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters" -Name "AddrConfigControl" -Value 0 -PropertyType "DWORD" | |
ipconfig /flushdns | |
# Langkah terakhir: Restart PC atau Client GUI. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A) Klik start-menu windows, dan ketik "powershell". B) Right-click pilihan Windows Powershell pertama dan "Run As Administrator":