This code will work, I've also struggled with the same thing but now i got it :)

<script type="text/javascript">
function openall()
{
var strComputer = ".";
var SWBemlocator = new...