Skip to main content

Your OwnCloud Server on your Hyper-V – scrap dropbox

Do you want to create your own owncloud server with LVM support and easy updates through packages? Here is an easy guide (Note that Azure VMs do not come with LVM preinstalled on Ubuntu, so this guide is only for on-premise Hyper-V as far as the extension of the disk goes):

Collect information :
External IP to be used :
Internal IP to be used : 192.168.x.x
Ports to be forwarded to the LAN : 80,443,10000 (10000 for webmin administration)
Certificate to be used for secure communication :
Subdomain to be used for access :
Username : adminusername
Password :
Mysql Root Password :
owncloud username : adminusername
owncloud password :
owncloud mariadb database : owncloud
owncloud mariadb username : adminusername
owncloud mariadb password :
Download Software :

Install :
Create a new HyperV Virtual Machine named :
Install Ubuntu using the above ISO and configuring networking and usernames/password as above using the installation
wizard. Make sure to select the OpenSSH server in the end. (all the other steps just hit enter)
Connect to port 22 (ssh) on the server using putty or similar.
Run the following commands :
sudo -s
nano /etc/apt/sources.list

#Add the following lines in the end of the file :
deb sarge contrib
deb sarge contrib
#Hit ctrl+O
#Hit ctrl+X
cd /root
apt-key add jcameron-key.asc
apt-get update
apt-get install webmin
cd /tmp
sudo apt-key add – < Release.key
sudo sh -c “echo ‘deb /’ >>
apt-get update
apt-get install owncloud
apt-get install mariadb-server
mysql -u root -p

#On the mariadb prompt enter :
GRANT ALL ON owncloud.* to ‘owncloud’@’localhost’ IDENTIFIED BY ‘ENTER REQUIRED PASSWORD HERE‘;
sudo apt-get update && sudo apt-get upgrade
sudo apt-get update && sudo apt-get install owncloud
echo “<meta http-equiv=’refresh’ content=’0;url=/owncloud’ />” > /var/www/html/index.html

Go to http://ipaddress
Enter the credentials for the first user as chosen in the collection section of this article.
Where it says Storage and database, select : MySQL/MariaDB
Enter database user,password, and database name as above, leave localhost in the end.
Finish setup

You are done. Go login


Adding an extra 1 TB disk 

Extend the disk by attaching new VHDs
Shutdown the VM
Add an extra disk using hyperv manager (a new scsi disk of size : 1 TB)

#Login to ssh using putty
echo “- – -” > /sys/class/scsi_host/host0/scan
fdisk -l
#Identify the disk , for example it will be /dev/sdb. Then continue (this tutorial assumes sdb)
fdisk /dev/sdb
hit enter
hit enter
hit enter
pvcreate /dev/sdb1
#note the volume name thing. Mine looks like cloud-vg. use this for next steps
vgextend cloud-vg /dev/sdb1
lvextend /dev/cloud-vg/root /dev/sdb1
resize2fs /dev/cloud-vg/root


RTMP HLS nginx php Server – The easy way





Tired of paying for Wowza media server? Unreal media server?
Tired of trying to find a decent tutorial on how to build your own nginx rtmp server with php and hls support?
UPG.GR has the solution for you with a few easy steps (as usual)
*Note that a referral link to digital ocean is included in this article that will grant you 10$ of credit to try for free with no obligations

If you are an advanced linux user and have your own linux box, just run the following command on any Ubuntu and your done! : curl -sL | sudo bash –

Step 1
Go to digital ocean and get a free account with 10$ credits (to use for a month)


Step 2

Enter your email and select a password



Step 3

Activate your account and login to get your free credit



Step 4

Create a new droplet


Step 5

Select the 10$ a month droplet. This will be enough for testing and for about 100 concurrent users. Enter the subdomain of a domain you control For example if you have a domain enter “”. If you do not have domain just enter there whatever and you will access your server with the ip you will be provided.


Step 6

Select a country near you.


Step 7

Select your favorite UBUNTU distro. Watch this space for a Centos tutorial – request it in the comments and I ll do it for you.


Step 8

Create droplet :


Step 9

Wait for your droplet to be created


Step 10

Check your email for your login credentials


Step 11

In the meantime go your registra or dns server to map the subdomain you chose to the ip of the server you got in your email. In my example I am using the free tier of cloudflare to manage my dns (


Step 12

Go back to digital ocean and start the console (or just putty to the ip on port 22 and authenticate)





Step 13

Login using the credentials you are provided in your email


Step 14

Enter “sudo -s”


Step 15

Enter “sudo apt-get install curl -y”

Enter “curl -sL | sudo bash -”


Step 16

Your server is up! you can test it on the address you specified. Port 80 and 1935 is open. port 80 for the player port 1935 for the streaming. You may stream using Adobe Media Encoder (free). Remember to use the h.264 codec and not the default VP6 !


Connect and start streaming

Step 17

Test your streamer by visiting the main interface on the subdomain you defined or the ip address you were provided. I have prepared 5 streams. stream1,stream2,stream3,stream4,stream518

Step 18

Review my github projects where you can find all the source code for this project.

There are 3 projects :   –  Automation – Fork of the latest working nginx server (1.9.2) – Latest fork of the rtmp module for nginx

You can edit the nginx.conf to suit you needs at : /usr/local/nginx/conf/nginx.conf

You can find the html files that show the web interface at : /usr/local/nginx/html


To do :

Web administration for nginx.conf options
Ftp server to edit the php files

Please comment here to encourage me to continue with this project.

Cleanup AD Dirsync Partitions

If you just installed DirSync and started a sync between your AD and the Azure AD (Office 365) you will notice that all sorts of crap has been transferred online.

Time for a clean-up!

First of all, create an OU, Users if not already. Then make 5 more OUs, Active Users, Disabled Users, Shared Resources, Distribution Groups, Security Groups. Then move the objects you have active in there. You need to have a tidy AD to do this right!

Then on you dirsync server go to : C:\Program Files\Windows Azure Active Directory Sync\SYNCBUS\Synchronization Service\UIShell\miisclient.exe and start the client.

On the Management Agents Tab, select the Active directory connector, then properties, Configure directory partitions. Then Containers.  Select the containers you made in previous steps, excluding Disabled users.

Now, next sync will be only for those partitions! Now time for the actual clean-up. We need to get rid of all the extra items that have been carried into our 365.

On the same screen, go under “Configure de-provisioning” and select “Stage a delete on the object for the next export run”

Open Regedit and browse to HKEY_LOCALMACHINE\Software\Microsoft\MSOLCoExistence. Modify theFullSyncNeeded registry entry to a value of 1, and then click OK. This value will be reset to 0 after a full synchronization is completed.

Force a sync using powershell  (Import-Module Dirsync, Start-OnlineCoexistenceSync)


You are done!



Delete Windows Files with Permissions

Here is how to delete windows files that you cannot figure out the permissions.

For example files on a drive that contains an older windows installation, the users folder, the program data folder, the program files folder, the windows folder, the windows.old folder etc

The scripts bellow will create a context menu in your explorer. When you right click on a folder it will start taking ownership of the files, After this, you will be able to delete them!

You will need to import the following in to your registry :


Windows Registry Editor Version 5.00

@="Take Ownership"

@="cmd.exe /c takeown /f \"%1\" && icacls \"%1\" /grant administrators:F"
"IsolatedCommand"="cmd.exe /c takeown /f \"%1\" && icacls \"%1\" /grant administrators:F"

@="Take Ownership"

@="cmd.exe /c takeown /f \"%1\" /r /d y && icacls \"%1\" /grant administrators:F /t"
"IsolatedCommand"="cmd.exe /c takeown /f \"%1\" /r /d y && icacls \"%1\" /grant administrators:F /t"

If you want to remove the right click menu use this :

Windows Registry Editor Version 5.00



Here is a zip file containing the reg keys that you can just import and you are done with out playing around with the code above : TakeOwnership

Installing DirSync tool errors – Solved!

I have installed the dirsync tool in multiple instances for our clients. There has not been ONE time where everything went smooth, there is always an error, even in clean installations of the OS.
Here is the ultimate solution.

You might see errors like sqlexpress did not install, error code -2067922934 etc.

Consider the following scenario,
You are migrating a client to 365, so you need the dirsync tool to sync the 365 with the local AD.
Following the microsoft guidelines, you create a VM with 100GB HDD, and at least 4GB RAM running an updated version of 2008 R2 or 2012
You join the domain and you login with an account with admin rights.
Those are not enough. The importan step you are missing and the reason you ended up on this page is outlines in the following KB :


Here are the steps :

  1. Log on to the computer as a user who has administrative credentials.
  2. Click Start, click Run, type Control admintools, and then click OK.
  3. Double-click Local Security Policy.
  4. In the Local Security Settings dialog box, click Local Policies, double-click User Rights Assignment, and then double-click Backup Files and Directories.
  5. In the Backup Files and Directories Properties dialog box, click Add User or Group.
  6. In the Select User or Groups dialog box, type the user account that is being used for setup, and then click OK two times.
  7. Repeat the procedure for the other two policies that are mentioned in the “Cause” section.
  8. On the File menu, click Exit to close the Local Security Settings dialog box.

You might want to make this into a domain GPO and add the admin user and apply it to all your clients so you don’t have this in the future


Here is how to check what the current user has before and after :

Download this tool :

Then run accesschk.exe -a yourdomain\yourusername *

Convert audio between MP3, FLAC, WAV

Using Sox, LAME, FLAC, and madplay – I put together this “dictionary” of shell commands that can be run to convert audio from one format to other, including dialup-modem-streamable lofi mono MP3 files, and including shorter clips of music.

Above each command-line and the INPUT and OUTPUT audio formats. (represented by $in and $out in the command line.)

For short audio clips, you need $start – what second to start the clip at, and $duration – how long the clip should go. All clips have a 1-second fade-in, and 2-second fade-out.

You can use the commands in php : Try putting any of the commands in the article, into the PHP command shell_exec(). The server must have the lame installed

flac wav
flac -sd $in -o $out

flac wav clip
flac -sdc $in | sox -t wav - -t raw -s -w -c 2 - trim $start $duration | sox -t raw -r 44100 -s -w -c 2 - $out fade h 1 $duration 2

flac wav-lofi
flac -sdc $in | sox -t wav - -s -w -c 1 -r 22050 $out rate

flac mp3-hifi
flac -sdc $in | lame - $out

flac mp3-hifi clip
flac -sdc $in | sox -t wav - -t raw -s -w -c 2 - trim $start $duration | sox -t raw -r 44100 -s -w -c 2 - -t wav - fade h 1 $duration 2 | lame - $out

flac mp3-lofi
flac -sdc $in | sox -t wav - -t wav -s -w -c 1 -r 22050 - rate | lame -b 80 - $out

flac mp3-lofi clip
flac -sdc $in | sox -t wav - -t raw -s -w -c 1 -r 22050 - rate | sox -t raw -r 22050 -s -w -c 1 - -t raw -r 22050 -s -w -c 1 - trim $start $duration | sox -t raw -r 22050 -s -w -c 1 - -t wav - fade h 1 $duration 2 | lame -b 80 - $out

wav flac
flac -s $in -o $out

wav wav clip
sox -t wav $in -t raw -s -w -c 2 - trim $start $duration | sox -t raw -r 44100 -s -w -c 2 - -t wav $out fade h 1 $duration 2

wav wav lofi
sox -t wav $in -s -w -c 1 -r 22050 $out rate

wav mp3-hifi
lame $in $out

wav mp3-hifi clip
sox -t wav $in -t raw -s -w -c 2 - trim $start $duration | sox -t raw -r 44100 -s -w -c 2 - -t wav - fade h 1 $duration 2 | lame - $out

wav mp3-lofi
sox -t wav $in -t wav -s -w -c 1 -r 22050 - rate | lame -b 80 - $out

wav mp3-lofi clip
sox -t wav $in -t raw -s -w -c 1 -r 22050 - rate | sox -t raw -r 22050 -s -w -c 1 - -t raw -r 22050 -s -w -c 1 - trim $start $duration | sox -t raw -r 22050 -s -w -c 1 - -t wav - fade h 1 $duration 2 | lame -b 80 - $out

mp3 flac
madplay -q -o wave:- $in | flac -s - -o $out

mp3 wav clip
madplay -q -o wave:- $in | sox -t wav - -t raw -s -w -c 2 - trim $start $duration | sox -t raw -r 44100 -s -w -c 2 - $out fade h 1 $duration 2

mp3 wav lofi
madplay -q -o wave:$out -m -R 22050 $in

mp3 mp3-hifi
cp $in $out

mp3 mp3-hifi clip
madplay -q -o wave:- $in | sox -t wav - -t raw -s -w -c 2 - trim $start $duration | sox -t raw -r 44100 -s -w -c 2 - -t wav - fade h 1 $duration 2 | lame - $out

mp3 mp3-lofi
madplay -q -o wave:- -m -R 22050 $in | lame -b 80 - $out

mp3 mp3-lofi clip
madplay -q -o wave:- -m -R 22050 $in | sox -t raw -r 22050 -s -w -c 1 - -t raw -r 22050 -s -w -c 1 - trim $start $duration | sox -t raw -r 22050 -s -w -c 1 - -t wav - fade h 1 $duration 2 | lame -b 80 - $out

Enabling logon audit Policy

Ever wandered who logged on and when on a windows PC or server ?
This is not enabled by default, here is how to enable it :

  1. Type gpedit.msc
  2. Navigate to the following folder: Local Computer Policy –> Computer Configuration –> Windows Settings –> Security Settings –> Local Policies –> Audit Policy.
  3. Double click the auto logon events
  4. Enable both
  5. You can view all those extra events from now on in the event log under : ID 4624





Roku Development – hls support

It took me sometime to figure this out, so I am posting this here for all of you stuck in this too!

If you got to this page you are probably trying to create a nice ROKU channel and started with the RokuSDK\examples\zips\

You deploy the app, and you see that it has a nice interface but all the examples in the feeds are mp4 files and not hls. So you figure, ok, I ll take the example code and I will replace “mp4” with “hls” and then on the content, I will replace the mp4 file with my m3u8 stream. Then you try it and you see nothing..

Here is the original piece of code :


Here is the modified piece of code :



And here is the solution to your problems! :

On line 165 (or anywhere else really) on the file showFeed.brs you need to add the following code :


If item.StreamFormat="hls"
End If



You may download the modified showFeed.brs

Apply a wildcard certificate on Exchange server 2010

This is the fasted and cheapest way to do this.

  1. Go get the Digicert Certificate Utility from
  2. Download it on the server you want to install the certificate
  3. Run the utility and select the existing expiring certificate (You may cleanup older eand expired ones too)
  4. Click on “Create CSR” and agree to import attributes from the previous certificate
  5. For the common name input : “*” (where is the domain in question)
  6. For the Subject Alternative Names , leave it blank
  7. Complete the rest accuretely and select at least 2048 for the key size.
  8. Hit Generate. Copy the CSR and use it for step 13
  9. Go to (create an account if you do not have one already)
  10. Purchase a wildcard Comodo SSL Certificate ($107.15 at the time of this article)
  11. Go back to Namecheap and view your available certificates
  12. Click on Activate Now
  13. Paste the CSR from step 8 and Submit the Request. You will be asked to provide a valid email. Make sure you have access to it!
  14. A few seconds later, go to the email and approve the certificate request.
  15. A few minutes later you will find the certificate on your namecheap registered email inbox
  16. Copy the certificate on the server, in the same directory as the digicert utility.
  17. Restart the digicert utility
  18. You will now see the new certificate ready to be applied! Select it and hit install
  19. Give it a friendly name like “wildcard2014”
  20. Your certificate is now installed. Now you will need to make it default for the required services
  21. Open IIS and expand until you get to the default website. Right click and select “Edit Bindings”
  22. Select all entries that are “https” on port “443” (there might be just one) – Set the binding to the new certificate (You will see it by its friendly name)
  23. Restart IIS (Top Left of the console) – Be patient, might take 2-3 minutes – this will downtime for users
  24. Test the OWA at : and check the certificate with chrome. It should be by comodo and should be valid and green
  25. In most of the cases you are now done! There are some other cases though that you will need some extra configuration
  26. Open the exchange console
  27. Go to Microsoft Exchange-Microsoft Exchange On-Premises-Server Configuration-Client Access
  28. Go through the Outlook Web App,Exchange Control Panel,Microsoft Server Active Sync and make sure that the internal and the external addresses are pointing to the outside , certified website and not for example domain.loca/owa etc
  29. If you run into other problems with people getting error messages in their outlook clients, you might want to check with powershell the virtual hosts.
  30. Start the Exchange Management Shell and run the following : Get-ClientAccessServer  Get-WebServicesVirtualDirectory  Get-OABVirtualDirectory  You might need to check those for problems too.


If you run into problems, just start the discussion here, I have done this many times, and this will definitely work!