Asked to convert an application to Java
994043Mar 6 2013 — edited Mar 6 2013I have a small GUI tool written in another language that serves as a front end for Microsoft's SCCM 2007. The customer that I originally wrote this for has asked if it could be converted to Java (they are a Java shop), but I am struggling with the methodology of the language. I have some background in C++ and C#, so have a basic understanding of OO stuff, just seem to be faltering on syntax. Below is an example of connecting to the SCCM server and polling for a list of collections. I cannot figure out how to make a simple app in Java to do the same. Any suggestions would be greatly appreciated, even if the suggestion is "don't use Java for this".
$oLocator = ObjCreate("WbemScripting.SWbemLocator")
$objSMS = $oLocator.ConnectServer($SiteServer, "root\sms\site_" & $provSiteCode)
If @error Then MsgBox(0, "", "Can't Connect")
$objSMS.Security_.ImpersonationLevel = 3
$objSMS.Security_.AuthenticationLevel = 6
$sShell = ObjCreate("Wscript.Shell")
$oFSO = ObjCreate("Scripting.FileSystemObject")
$SWbemLocator = ObjCreate("WbemScripting.SWbemLocator")
$SWbemServices = $SWbemLocator.ConnectServer($SiteServer,"root\SMS\site_" & $provSiteCode)
$connection= $swbemServices
$oResults = $objSMS.ExecQuery("SELECT * FROM SMS_FullCollectionMembership WHERE CollectionID = 'SMS00001'")
For $PC In $oResults
MsgBox(0, "", $PC)
Next