Windows: Backup with diskshadow.exe


Windows Server 2008 and alter version are shipped with a tool called diskshadow. This program can be used to create snapshots of disks and expose them as Folder or as DriveLetter means files are in a consistent state and you can save openfiles.

Some examples. Starting diskshadow. It accept a  parameter /l  for a logfile. And a Parameter /s for a (diskshadow) script file to execute. diskshadow has the same “look and feel” like diskpart 🙂  and start with a prompt:

Microsoft DiskShadow version 1.0
Copyright (C) 2013 Microsoft Corporation
On computer:  windev,  12.06.2014 20:28:33

First set diskshadow in defined state with reset

Continue reading Windows: Backup with diskshadow.exe

Advertisment to support

VMware: PowerCli Scripts in native Powershell


when you want to execute your PowerCli script you have to start the “VMware vSphere PowerCLI” shell before. But, for example Schedule Tasks, it whould be nice that the script load the PowerCli environment itself. Then you simply have to start your script like this

%Systemroot%\System32\WindowsPowerShell\v1.0\powershell.exe -File YourPowerCliScript.ps1

To load the PowerCli script Environent in your powershell script add this lines at the top of your script.
Continue reading VMware: PowerCli Scripts in native Powershell

VMware vSphere: Create a linked clone with Powercli


linked clones have some advantages:

  • New virtual machines are rapidly deployed. The initial task is only to reference to a snapshot of an existing virtual machine. No virtual disk file(s) will be copied at this time.
  • They save disk space. Because only the space difference to the origin snapshot is allocated.

I found no option in the vSphere respective the Webclient to create one, but PowerCli provides this. Lets do it.
Connect to vCenter

Connect-VIServer vcenter.subdomain.domain.local

Define the virtual machine which is the origin of the linked clone, and the Snapshotname on which the linked clone based.


Continue reading VMware vSphere: Create a linked clone with Powercli

Windows: Cannot bring up Cluster Networkname Resources


a customer has, accidentally, deleted multiple Active Directory Computer objects which correspond to Network Name Resources of a Windows Cluster 🙁 .

The cluster network name itself was also affected and no backup of the AD Database to restore the objects was available.

All solutions that I’ve found to get the cluster working again are based on the restore of the AD objects.

But there is also another way respective hack 🙂 . This works for me on a Windows 2008 R2 Cluster.
Typical error are:

  • Event ID 1207 is logged to the Eventlog: “Unable to get Computer Object using GUID” “There is no such object on the server.”
  • Or in the C:\Windows\Cluster\Reports\cluster.log file (exported with cluster.exe log g)
    Network Name <Clustername>: Unable to Logon. winError 1326

Continue reading Windows: Cannot bring up Cluster Networkname Resources

Linux: Some ffmpeg command line examples


here are a list of some command line examples for converting audio and video files with ffmpeg. ffmpeg is part of the most linux distributions but there is also a Windows version available.

Convert ogg to mp3, with -a you can specify some audio options here a bitrate of 192k

ffmpeg -i input.ogg -ab 192k output.mp3

To remove the embedded cover(Cover is saved as Video Stream)

ffmpeg -i input.mp3 -vn -ab 192k output.mp3

To remove cover and copy the audio stream, no remux is done => better quality

ffmpeg -i input.mp3  -y -map 0:a -codec:a copy -map_metadata -1  output.mp3

Covert a MKV container to avi. 2 Steps required.

Step 1 (h264 -> mpeg4)

ffmpeg -i video.mkv -qscale 0 -acodec copy temp.avi

and Step 2

ffmpeg -i temp.avi -vcodec mpeg4 -b 4000k -acodec mp2 -ab 320k output.avi

MPEG4 to xvid Bitrate 1200kb half resolution, AC3 to mp3 128kb

ffmpeg -i temp.avi -vf scale=iw/2:-1 -b 1200k -q:v 2 -q:a 2 -c:v libxvid  -c:a libmp3lame -b:a 128k output.avi

Another simple way to xvid

 ffmpeg -i input.avi -c:v mpeg4 -vtag xvid output.avi

MKV to xvid 4:3

 ffmpeg -i input.mkv -sn -c:a libmp3lame -ar 48000 -ab 128k -ac 2 -c:v libxvid -crf 24 -vtag DIVX -vf scale=640:480 -aspect 4:3 -mbd rd -flags +mv4+aic -trellis 2 -cmp 2 -subcmp 2 -g 30 -vb 1500k output.avi

MKV to xvid 16:9

 ffmpeg -i input.mkv -sn -c:a libmp3lame -ar 48000 -ab 128k -ac 2 -c:v libxvid -crf 24 -vtag DIVX -vf scale=720:480 -aspect 16:9 -mbd rd -flags +mv4+aic -trellis 2 -cmp 2 -subcmp 2 -g 30 -vb 1500k output.avi

Format to play on some DVD Player with SDCard (Medion for example)

ffmpeg -i input.mkv -f avi -c:v libxvid -qscale:v 2 -vf scale=512x280 -c:a libmp3lame -b:a 320k output.avi

and with a limited bitrate

ffmpeg -i input.mkv -f avi -c:v libxvid -b:v 1M -maxrate 1M -bufsize 1M -vf scale=512x280 -c:a libmp3lame -b:a 320k output.avi

Scale to a specific resolution and preserve aspect ration

ffmpeg -i temp.avi  -vf scale=320:-1 output_320.avi

Scale to the current resolution divided by 3

ffmpeg -i -vcodec libx264 -acodec aac  -vf scale=iw/3:ih/3 test.mp4

Concat 2 files with the same codec. Create a list of video files and write it to file

cat movlist.txt
file 'movPart1.avi'
file 'movPart2.avi'
ffmpeg -f concat -i movlist.txt -c copy mov.avi

Same but with mp3 files, Metadata are used from mp3File1.mp3

ffmpeg -i "concat:mp3File1.mp3|mp3File2.mp3" -acodec copy mp3file.mp3

Export Metadata from an mp3 file

ffmpeg -i mp3File1.mp3 -f ffmetadata mp3File1.metadata

With new metadata

ffmpeg -i "concat:mp3File1.mp3|mp3File2.mp3" -metadata "title=My Heavy Song" -metadata "artist=Metalartist" -metadata "album=Best Metal Album ever" -acodec copy mp3file.mp3  -vn

To flip a video vertically

ffmpeg -i in.avi -vf vflip flipped.avi

To flip a video horizontally

ffmpeg -i in.avi -vf hflip flipped.avi

Rotate 90° clockwise

ffmpeg -i in.avi -vf transpose=1 flipped.avi

Rotate 90° counterclockwise

ffmpeg -i in.avi -vf transpose=2 -c:a flipped.avi

Transpose does a reencoding of the whole video. This simply rotates the video

ffmpeg -i  -metadata:s:v rotate="90" -codec copy

To map the german audio channel as default. List channels

ffmpeg -i in.avi 2>&1 |grep Stream
    Stream #0:0(eng): Video: h264 (High), yuv420p(tv, bt709/unknown/unknown, progressive)1k tbn, 47.95 tbc (default)..
    Stream #0:1(ger): Audio: ac3, 48000 Hz, stereo, fltp, 224 kb/s (default) (forced)
    Stream #0:2(eng): Audio: ac3, 48000 Hz, 5.1(side), fltp, 640 kb/s

To select the german Audio stream as default use -map 0:a:0, means 1st Audio stream (counted from 0)

ffmpeg -i in.avi ... -map 0:v:0 -map 0:a:0 ...

Convert a Video to a Whatsapp compatible format

ffmpeg -i in.avi -c:v libx264 -profile:v baseline -level 3.0 -pix_fmt yuv420p out.mp4

Cut a video. From second 30 for a length of 10sec

ffmpeg -ss 00:00:30.0 -i input.wmv -c copy -t 00:00:10.0 output.wmv
ffmpeg -ss 30 -i video.mp4 -c copy -t 10 video.mp4

Fade in, fade out

ffmpeg -i video.mp4 -vf "fade=t=in:st=0:d=3" -c:a copy out.mp4
ffmpeg -i video.mp4 -vf "fade=t=out:st=10:d=5" -c:a copy out.mp4

To be continued


My Knowledgebase for things about Linux, Windows, VMware, Electronic and so on…