Golang With Race Detector on Windows

Install gcc with:

choco install winlibs
or
scoop install winlibs

Convert MBR to GPT

Follow this manual:

https://learn.microsoft.com/en-us/windows/deployment/mbr-to-gpt

Remote Reboot

Remote Reboot

net use \\<<server>>\IPC$ <<password>> /USER:<<user>>
shutdown /r /m \\<<server>> /c "Comment" /f /d U:0:0

If you got an error message:

A system shutdown is in progress.(1115)

You can try https://download.sysinternals.com/files/PSTools.zip

Execute:

.\pskill \\Computer-Name winlogon
.\pskill \\Computer-Name TrustedInstaller

Docker

With virtualbox

Docker and virtualbox are not working together.

Docker uses Hyper-V which breaks Virtualbox.

To disable Hyper-V execute in an admin shell:

bcdedit /set hypervisorlaunchtype off

and reboot.

To enable it again:

bcdedit /set hypervisorlaunchtype auto

and reboot.

Backup using rsync

The backup will copy files from windows to a NAS that has a share available via rsync.

Install Cygwin

Make sure you have cygwin installed with the package rsync.

For all further steps I expect that cygwin was installed in C:\cygwin64

Configure the NAS

Backup Script

I store my script in folder %userprofile%.

#!/bin/sh
rsync -aP --delete /cygdrive/d/bilder rsync://idefix@nas/Bilder

Shortcut in Windows

To get the script easily executed we create a shortcut on our desktop.

Fill as target:

C:\Windows\System32\cmd.exe /c ""C:\cygwin64\bin\sh.exe" --login -i /cygdrive/c/Users/idefix/backup.sh"

Fill as path:

C:\cygwin64

If you now click the shortcut, it should open a window and directly start with the sync.

Add Script to Taskbar

To add a script (e.g. a shell script) into your taskbar create a shortcut of your script. Then edit the target from e.g.:

D:\tools\updateapp.bat

to

cmd /C D:\tools\updateapp.bat

Maybe you would like to also change the icon?

Now right click it and select “Pin to taskbar”.

Run Script As Admin

To run a script on newer windows version with UAC enabled you can use the following wrapper:

:::::::::::::::::::::::::::::::::::::::::
:: Automatically check & get admin rights
:::::::::::::::::::::::::::::::::::::::::
@echo off
CLS
ECHO.
ECHO =============================
ECHO Running Admin shell
ECHO =============================

:checkPrivileges
NET FILE 1>NUL 2>NUL
if '%errorlevel%' == '0' ( goto gotPrivileges ) else ( goto getPrivileges )

:getPrivileges
if '%1'=='ELEV' (echo ELEV & shift /1 & goto gotPrivileges)
ECHO.
ECHO **************************************
ECHO Invoking UAC for Privilege Escalation
ECHO **************************************

setlocal DisableDelayedExpansion
set "batchPath=%~0"
setlocal EnableDelayedExpansion
ECHO Set UAC = CreateObject^("Shell.Application"^) > "%temp%\OEgetPrivileges.vbs"
ECHO args = "ELEV " >> "%temp%\OEgetPrivileges.vbs"
ECHO For Each strArg in WScript.Arguments >> "%temp%\OEgetPrivileges.vbs"
ECHO args = args ^& strArg ^& " "  >> "%temp%\OEgetPrivileges.vbs"
ECHO Next >> "%temp%\OEgetPrivileges.vbs"
ECHO UAC.ShellExecute "!batchPath!", args, "", "runas", 1 >> "%temp%\OEgetPrivileges.vbs"
"%SystemRoot%\System32\WScript.exe" "%temp%\OEgetPrivileges.vbs" %*
exit /B

:gotPrivileges
if '%1'=='ELEV' shift /1
setlocal & pushd .
cd /d %~dp0

::::::::::::::::::::::::::::
::START
::::::::::::::::::::::::::::

REM Run shell as admin (example) - put here code as you like
ECHO Arguments: %1 %2 %3 %4 %5 %6 %7 %8 %9
C:\WINDOWS\system32\cmd.exe /c ""C:\Program Files\Git\usr\bin\sh.exe" --login -i /d/tools/restarttomcat.sh"

Kill remotely a task

taskkil /S \\<<servername>> /IM Tomcat7.exe

Using Remote Desktop 8-bit Color Depth

If you use a high resolution screen and windows server 2003 SP2 only shows you 8-bit color (256 colors) you can do the following. See these links:
http://www.microsoft.com/en-us/search/DownloadResults.aspx?q=kb2685939 http://support.microsoft.com/kb/942610

Download hotfix:
http://hotfixv4.microsoft.com/Windows%20Server%202003/sp3/Fix205471/3790/free/330838_ENU_i386_zip.exe

After applying the hotfix change registry key:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\AllowHigherColorDepth
to 1.

Virtualbox

Use physical disk on Win7

Run cmd as administrator. Run diskpart.

list disk
select disk 3
offline disk
attributes disk clear readonly
attributes disk

Exit diskpart.

Create vmdk file with:

"c:\Program Files\Oracle\VirtualBox\VBoxManage.exe" internalcommands createrawvmdk -filename d:\virtualbox\usb3disk0.vmdk -rawdisk \\.\PhysicalDrive3
RAW host disk access VMDK file d:\virtualbox\usb3disk0.vmdk created successfully.

Start Virtualbox and enter global settings. Change the path for VMs to D:\virtualbox. Close virtualbox and start it as administrator.

Choose you VM, click change, and add your vmdk file as harddisk. Start your VM and enjoy.

Vista

Integrate Updates to Install DVD

At first we need the windows AIK, you can download it here [[http://www.microsoft.com/downloads/details.aspx?displaylang=de&FamilyID=94bb6e34-d890-4932-81a5-5b50c657de08]]

Vista 64Bit -> 32Bit Programs cant reach the Network - solution

Start the Command-Line as Administrator (Start, Run “cmd”, Rightklick, Run as Administrator)

A black Commandline-Box appears, type:

netsh
winsock
reset

Now the following Text appears:

Der Winsock-Katalog wurde zurückgesetzt.
Sie müssen den Computer neu starten, um den Vorgang abzuschließen.

Type

exit

Reboot the Computer.

XP

Slow domain login

Do the following to speed up the login:

start-->run-->gpedit.msc-->Computer Configuration-->Administrative Templates-->System-->Logon

Enable “Always wait for the network at computer startup and logon”.

see

How to remove not connected Devices

To see and remove not connected devices in the DeviceManager, do the following:

Set an Evironment Variable “DEVMGR_SHOW_NONPRESENT_DEVICES” to the Value “1”. Over the DOS-Box:

SET DEVMGR_SHOW_NONPRESENT_DEVICES=1

or over the Menue:

German Windows: "Systemeigenschaften" - "Erweitert" - "Umgebungsvariablen"

Now go to the DeviceManager, and activate in the Pulldown-Menue

German Windows: "Ansicht" - "Ausgeblendete Geräte anzeigen"

now you can see all Devices, Present or not. Removal of un-used Devices increases the Bootup-Speed too.

Optimize Removal Devices to Remove Without Deactivating

Rightklick on the Drive, Properties (Eigenschaften)
Tab “Hardware”
Search for the Device in the List, select Properties (Eigenschaften)
Tab “Richtlinien”
German Windows: “Für schnelles Entfernen optimieren”
English Windows: “Optimice for fast removal”

Login User Automatically

http://support.microsoft.com/kb/315231/de

Or the easyer Way:
Start - Run: “CONTROL USERPASSWORDS2”
In the upcoming Dialog remove the Checkfield “User must enter Passwort”. Select the User who shouldt be Logged in. Press OK, enter the desired Password - ok.

Windows “Zeitsynchronisierung” select new Intervall

Bei Windows-Rechnern, die nicht in Domänen hängen:

Um die Zeitsynchronisation unter Windows häufiger ausführen zu lassen (Standart ist jede Woche einmal):
In der Registry folgenden Wert anpassen:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpClient\SpecialPollInterval

Das gewünschte neue Intervall in Sekunden in den Wert eintragen.
Danach den Dienst “W32Time” (Windows-Zeitgeber) neu starten.

Auf die Uhrzeit in der Taskleiste doppelklicken (alternativ Systemsteuerung/Datum und Uhrzeit), und einen gültigen NTP-Server eintragen. “Jetzt Synchronisieren” klicken. Das Datum der nächsten Abfrage sollte nun richtig sein.

Reduce the Wait Time for chkdsk at Startup

To reduce the 10 seconds to 0 type in the console:

chkntfs /T:0

Build your Own Windows CD

http://www.german-nlite.de/

Log MSI Installation

Add to your registry the following key:

KEY_LOCAL_MACHINE\\Software\\Policies\\Microsoft\\Windows\\Installer
String value: Logging=voicewarmup

It generates in your temp folder a logfile, search their for commandline.

Single Sign On

[[http://support.etouch.net/cm/wiki/support.Downloads.wiki/home/Configuring%20SSO%20using%20NTLM%20for%20IIS5.0.html]]

Process Explorer

[[http://www.microsoft.com/technet/sysinternals/processesandthreads/processexplorer.mspx]]

Automatic Proxy Configuration

Typical names for proxy auto configuration are:

You can also ask the nameserver with:

dig axfr @<nameserver> zone |grep wpad

The link is then:

wpad.domain/wpad.dat

Remove Service

Go to management console and search for the service name inside the service property. Stop the service now.

Then open the command shell and insert:

sc delete <servicename>

Scan Windows Systemfiles for Changes (DE)

Windows XP Systemdateien überprüfen lassen

Windows XP legt glücklicherweise automatisch eine Kopie der wichtigsten Systemdateien an um einen fehlerfreien Betrieb zu gewährleisten. Diese Kopien der Systemdateien befinden sich im Ordner Windows\System32\dllcache. Dieser Ordner ist versteckt und nur sichtbar, wenn man die entsprechenden Optionen im Explorer eingestellt hat.

Wird eine dieser dort gesicherten Systemdateien gelöscht oder beschädigt, beispielsweise durch einen Virus oder ein Missgeschick, wird die Originaldatei automatisch wiederhergestellt.

Man kann diese Überprüfung und Wiederherstellung auch manuell starten und durchführen z.B. wenn man den Verdacht hat das irgendetwas in dieser Richtung passiert ist. Dazu öffnet man durch Eingabe von cmd unter Start -> Ausführen die Eingabeaufforderung. Hier wird nun der Befehl sfc eingegeben. Zusätzlich werden an sfc noch Parameter, getrennt mit einem Leerzeichen, angehängt.

Folgende Parameter sind dabei möglich:

Werden falsche oder beschädigte Dateien gefunden, werden diese durch die Original-Versionen ersetzt. Dies geschieht, bildschirmgeführt, mit der Windows-CD.