Code Snippets

AutoLogon_enable

AutoLogon_enable

### Enable ‚AutoLogon‘ Set-ItemProperty -Path "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" -Name "AutoAdminLogon" -Value "1" ### Specify for which user AutoLogon should be enabled Set-ItemProperty -Path "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" -Name "DefaultUsername" -Value "Administrator" ### Extract the initial Administrator Password from the VMWare Config $vmwaretoolspath = "C:\Program Files\VMware\VMware Tools\vmtoolsd.exe" $tmp = & $vmwaretoolspath –cmd "info-get guestinfo.cloudinit.metadata" | Out-String $tmp = [System.Text.Encoding]::ASCII.GetString([System.Convert]::FromBase64String($tmp))...

Load_HKEY_USER_Hive

Load_HKEY_USER_Hive

### Get SID of local Administrator $localadmin = Get-LocalUser | where {$_.Name -like "Administrator"} ### Load HKEY_USER Hive of local Administrator reg load HKU\$($localadmin.SID.Value) C:\Users\Administrator\ntuser.dat ### Check if ‚RunOne‘ Key is already available, if not create it if(!(Test-Path -Path Registry::HKEY_USERS\$($localadmin.SID.Value)\Software\Microsoft\Windows\CurrentVersion\RunOnce)){ New-Item -Path Registry::HKEY_USERS\$($localadmin.SID.Value)\Software\Microsoft\Windows\CurrentVersion\RunOnce } ### Create RunOnce Variable und set Path to Powershell Script Set-ItemProperty...

SetRegion.ps1

SetRegion.ps1

$regionPS = {& $env:SystemRoot\System32\control.exe "intl.cpl,,/f:`"C:\Windows\Temp\Region_de-AT.xml`""} Add-Content -Path "C:\Windows\Temp\SetRegion.ps1" -Value $regionPS

Region_de-AT.xml

Region_de-AT.xml

$regionalsettingsAT = "<gs:GlobalizationServices xmlns:gs=’urn:longhornGlobalizationUnattend‘> <!–User List–> <gs:UserList> <gs:User UserID=’Current‘ CopySettingsToDefaultUserAcct=’true‘ CopySettingsToSystemAcct=’true’/> </gs:UserList> <!– user locale –> <gs:UserLocale> <gs:Locale Name=’de-AT‘ SetAsCurrent=’true‘ ResetAllSettings=’true’/> </gs:UserLocale> <!– system locale –> <gs:SystemLocale Name=’de-AT’/> <!– GeoID –> <gs:LocationPreferences> <gs:GeoID Value=’14’/> </gs:LocationPreferences> <gs:MUILanguagePreferences> <gs:MUILanguage Value=’de-AT’/> </gs:MUILanguagePreferences> <!– input preferences –> <gs:InputPreferences> <!–en-AU–> <gs:InputLanguageID Action=’add‘ ID=’0c07:00000407′ Default=’true’/> </gs:InputPreferences> </gs:GlobalizationServices>" $regionalsettingsAT | Out-File C:\Windows\Temp\Region_de-AT.xml...

Linux_Docker03

Linux_Docker03

apt-get update apt-get install docker-ce docker-ce-cli containerd.io

Linux_Docker02

Linux_Docker02

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add – add-apt-repository \ "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) \ stable"

Linux_Docker01

Linux_Docker01

apt-get update apt-get install \ apt-transport-https \ ca-certificates \ curl \ gnupg-agent \ software-properties-common

Linux_Docker04

Linux_Docker04

timedatectl set-timezone Europe/Vienna

Password in Powershell Script #004

Password in Powershell Script #004

### Step 1: Creating Securestring encrypted with AES Key $AESKey = New-Object Byte[] 32 [Security.Cryptography.RNGCryptoServiceProvider]::Create().GetBytes($AESKey) $AESKey | Out-File .\Desktop\aes.key $password = Read-Host -AsSecureString $password | ConvertFrom-SecureString -Key $AESKey | Out-File .\Desktop\password.txt ### Step 2: Using Securestring and AES Key in Scripts $username = "Administrator" $AESKey = Get-Content .\Desktop\aes.key $password = Get-Content .\Desktop\password.txt | ConvertTo-SecureString -Key...

Password in Powershell Script #003

Password in Powershell Script #003

### Step 1: Creating Securestring $password = Read-Host -AsSecureString $password | ConvertFrom-SecureString | Out-File .\Desktop\password.txt ### Step 2: Using Securestring in Scripts $username = "Administrator" $password = Get-Content .\Desktop\password.txt | ConvertTo-SecureString $credentials = New-Object System.Management.Automation.PSCredential (“$username”, $password)