Language: ChineseGermanSpanishFrenchDutchItalianRussian
123 Flash Chat Forums

Go Back   TOPCMM Community > SWFKit > SWFKit Support

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-27-2006, 12:43 AM
Junior Member
 
Join Date: Dec 2005
Posts: 12
Default accessing Active Directory with SWFKIT?

Hi,

I would like to access Active Directory.

Example:

in vb i would do....

Dim strComputer = "."
Dim processToKill = "IEXPLORE.EXE"
Dim processList, allIE


set processList = GetObject("winmgmts: {impersonationLevel=impersonate}!\\" _
& strComputer + "\\root\\cimv2")

set allIE = processList.ExecQuery("Select * from Win32_Process Where Name = " _
& strProcessKill );

How would i Do this in ffish?
Reply With Quote
  #2 (permalink)  
Old 05-02-2006, 05:07 PM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re:accessing Active Directory with SWFKIT?

Code:
var wbemFlagReturnImmediately = 0x10;
var wbemFlagForwardOnly = 0x20;

   var objWMIService = new ActiveXObject("winmgmts:\\\\.\\root\\CIMV2");
   var colItems = objWMIService.ExecQuery("SELECT *   FROM Win32_Process", "WQL",
                                          wbemFlagReturnImmediately/* | wbemFlagForwardOnly*/);
                                      

   var enumItems = new Enumerator(colItems);
   if (enumItems == null)
   {
   trace("No item found!");
   return true;
   }
   for (; !enumItems.atEnd(); enumItems.moveNext()) {
      var objItem = enumItems.item();
trace(objItem.properties_.item("name", 0).value);
trace(objItem.properties_.item("commandLine", 0).value);

   }
Reply With Quote
  #3 (permalink)  
Old 05-03-2006, 01:17 AM
Junior Member
 
Join Date: Dec 2005
Posts: 12
Default Re:accessing Active Directory with SWFKIT?

great thanks! Now I modified it a little and tried closing every instance of IEXPLORE.EXE but the terminate method would not do anything. Please advise.

var objWMIService = new ActiveXObject("winmgmts: {impersonationLevel=impersonate}!\\\\.\\root\\CIMV 2");
var colItems = objWMIService.ExecQuery("SELECT * FROM Win32_Process Where Name = 'IEXPLORE.EXE'");//, "WQL",
// wbemFlagReturnImmediately/* | wbemFlagForwardOnly*/);


var enumItems = new Enumerator(colItems);
if (enumItems == null)
{
trace("No item found!");
return true;
}
for (; !enumItems.atEnd(); enumItems.moveNext())
{
var objItem = enumItems.item();
Dialogs.msgBox((objItem.properties_.item("name", 0).value));
try{
objItem.Terminate();
}catch(err)
{
Dialogs.msgBox(err.description);
}
}
Reply With Quote
  #4 (permalink)  
Old 05-03-2006, 01:50 AM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re:accessing Active Directory with SWFKIT?

You cannot call
Code:
objItem.Terminate();
directly, because "terminate" is not a method of the objItem object, which encapsulates a "Win32_Process" object you want to access. To call a method of the "Win32_Process" object, you would have to do in the way shown as follows:

Code:
tMethod = objItem.methods_.item("terminate");
inParams = tMethod.InParameters.SpawnInstance_();
objItem.ExecMethod_(tMethod.name, inParams);
Reply With Quote
Reply

Was this information helpful?    Yes No



Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 03:39 AM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.