Re-Import VMs into Hyper-V
Normaly you can only import a Virtual Machine (VM) into Hyper-V if you have exported it. If you lose your Hyper-V settings or have to import it into a new Hyper-V Server in case of a desaster recovery than you can use the steps descripted in this (and other) blog post: http://blogs.msdn.com/b/robertvi/archive/2008/12/19/howto-manually-add-a-vm-configuration-to-hyper-v.aspx
The problem is that you have to handle many long pathes and cryptical GUIDs. I had to do that for a bunch of different VMs and being chronical lacy I created three batch files for it:
- importVM.cmd “GUID” “Path to Virtual Machine” creates the link and corrects the permissions on the link and the vm folder
- importSnapshot.cmd “SnapshotGuid” “VMGuid” “Path to Snapshot” creates the snapshot link and the right permission.
Not very impressiv? Well, the third batch files combines this two scripts:
- addMachine.cmd: Takes the basis path (the path where the sub-folder Virtual Machine, Snapshots exists) and extracts the VM-GUID, all Snapshots-GUIDs and the other pathes to automaticly create the links and permissions.
So with one simple command (addMachine.cmd C:\ClusterStorage\Volume4\VM1) you can import the complete VM.
— addMachine.cmd ——
Kleine Tools – große Wirkung
Gerade im AD-Umfeld finde ich die Tools von Joe Richards (http://joeware.net) immer wieder großartig. Mit ihnen lassen sich durch geschickte Verkettungen sehr schnell Aufgaben lösen. Dabei ist der Ansatz ähnlich wie bei Unix, d.h. ein Tool hat ein Aufgabenspektrum (z.B. finden, ändern, löschen, …) – die Tools wiederum können über die Std-out Ausgabe gekoppelt werden. Wer also nicht immer gleich die Power Shell starten will, sollte sich diese Programm verlinken.
Ninite–Tool zur Installation von Standardsoftware
Es gibt mittlerweile mehrere verschiedene Anbieter dieser Softwareart: Ein Programm, dass automatisiert bestimmte Standardsoftware wie Firefox, Thunderbird, VLC, Skype usw. installiert.
Ninite.com ist eines davon. Auf der Webseite werden die gewünschten Programme ausgesucht und der Download des Tools gestartet. Dieses installiert dann automatisch die ausgewählten Softwarepakete mit angepassten Einstellungen. Die Installationen laufen jeweils silent ab. Browsertoolbars und ähnliche unnütze Ergänzungen werden jeweils abgewählt.
Massenhafte Anpassung von DHCP Optionen
Möchte man auf die schnelle bei einem Windows 2008 DHCP Server in jedem Scope DHCP Options anpassen, so lässt sich dies mit ein paar Zeilen Batchcode erledigen:
for /f “usebackq skip=4” %%a in (`netsh dhcp server \DHCPSERVER show scope`) do (
netsh dhcp server \DHCPSERVER scope %%a set optionvalue 006 IPADDRESS ip.des.dns.servers ip.des.zweiten.dns
netsh dhcp server \DHCPSERVER scope %%a set optionvalue 015 STRING dns.name