Saturday 10 December 2016

Run task scheduler in command line

schtasks is used to create/run tasks in command line without the need to open "Task scheduler".

I've tried query and run parameters but not yet for create.

It is required to provide the task name including the folder that task is created in.

To query if a task exists
 >schtasks /query /tn "thelog"  
 ERROR: The system cannot find the file specified.  
 >schtasks /query /tn "Microsoft\thelog"  
 Folder: Microsoft  
 TaskName                 Next Run Time     Status  
 ======================================== ====================== ===============  
 thelog                  N/A          Ready  
 >schtasks /query /tn "Microsoft\the special log"  
 Folder: Microsoft  
 TaskName                 Next Run Time     Status  
 ======================================== ====================== ===============  
 the special log             N/A          Ready  

To run the task
 >schtasks /run /tn "Microsoft\thelog"  
 SUCCESS: Attempted to run the scheduled task "Microsoft\thelog".  
 >schtasks /run /tn "Microsoft\the special log"  
 SUCCESS: Attempted to run the scheduled task "Microsoft\the special log".  

It is needed to run tasks in elevated command prompt though.

IBM DSA utility to collect logs

A few command line switches can be used together with dsa to collect logs in different format.

When the executable is run without any parameters, it would save the log in XML format.

> ibm_utl_dsa_dsyte1d-9.61_portable_windows_x86-64.exe

To generate it in HTML format, -v must be used.

> ibm_utl_dsa_dsyte1d-9.61_portable_windows_x86-64.exe -v

To convert the log generated in XML to HTML format, the following command is used.
> ibm_utl_dsa_dsyte1d-9.61_portable_windows_x86-64.exe -v -x -i generated_log.xml.gz

To compare current log with previously collected one, -r switch with log files names together is used. Both logs must be generated using same version of DSA though.
> ibm_utl_dsa_dsyte1d-9.61_portable_windows_x86-64.exe -r generated_log_001.xml.gz generated_log_001.xml.gz -v


Saturday 12 March 2016

How to calculate to get an exact partition size

It is sometimes not great to see a partition size like 99.96GB or 100.30GB in My Computer. It is just not nice. I am a bit particular when it is about partition sizes. As Microsoft has chosen the way to partition using numbers in MB, it is always the issue, resulting in funny number of GB.

I used to go to a website and calculate the partition size but I unfortunately do not have access to it anymore. So, it has to be manual. This trick worked like a charm when I tried to resize a partition that was factory partitioned. I believe it would work for other situations as well.

What I did was for my 150GB partition after seeing someone's post in superuser.com.


Since I want a 150GB partition, I calculated like the following. 
(1024 x 150 ) + 4 = 153604

For every 1GB, it should be multiplied by 1024 and then 4MB should be added.

Mission accomplished finally. :)



Friday 4 March 2016

Download youtube clips (and subtitles)

youtube-dl. It is a small standalone executable file to download youtube clips and subtitles. I have no doubt this is a nice utility which does not have GUI unfortunately. So, one has to check the parameters for different download scenarios. I like to share the parameters I have tried successfully so far.

Download clip + subtitle
youtube-dl.exe --write-srt --sub-lang en https://www.youtube.com/watch?v=xxxxxxxxxxx

Download clip only
youtube-dl.exe https://www.youtube.com/watch?v=xxxxxxxxxxx

Download subtitle only
youtube-dl.exe --write-srt --sub-lang en --skip-download https://www.youtube.com/watch?v=xxxxxxxxxxx

--sub-lang may be replaced with desired language such as fr,es, and so on.