Skip to content

Instantly share code, notes, and snippets.

@cakriwut
Last active April 18, 2020 07:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cakriwut/695d4a6e1464a225cd196c9454575688 to your computer and use it in GitHub Desktop.
Save cakriwut/695d4a6e1464a225cd196c9454575688 to your computer and use it in GitHub Desktop.
# Requires $env:AdminUser $env:AdminPassword
Set-ExecutionPolicy Bypass -Scope Process -Force
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
Enable-WSManCredSSP -Role Server -Force
Enable-WSManCredSSP -Role Client -DelegateComputer * -Force
New-Item -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\CredentialsDelegation -Name AllowFreshCredentialsWhenNTLMOnly -Force
New-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\CredentialsDelegation\AllowFreshCredentialsWhenNTLMOnly -Name 1 -Value * -PropertyType String
$user = "$($env:computername)\$($env:AdminUser)"
$securePassword = ConvertTo-SecureString $env:AdminPassword -AsPlainText -Force
$credential = New-Object System.Management.Automation.PSCredential $user,$securePassword
Invoke-Command -Authentication CredSSP -ScriptBlock {choco install sql-server-express -y} -ComputerName $env:computername -Credential $credential
Invoke-Command -Authentication CredSSP -ScriptBlock {choco install ssms -y} -ComputerName $env:computername -Credential $credential
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment