"OldDog" <> wrote in message
news:576feb74-e96b-4325-ab61-...
On Dec 22 2008, 12:18 pm, "Linn Kubler" <lkub...@chartwellwisc2.com>
wrote:
> Hi,
>
> I have written a Visual FoxPro application to track my computer inventory.
> I adopted WMI scripting calls to remotely get information about the CPU,
> memory, NIC and hard drives from the computer in question. Works pretty
> slick. However, I've found one quirk that I'd like to correct if I can.
>
> Basically, if I query a computer then shut it down and exit my application
> it hangs. It's like one of the connections to the computer needs to be
> dropped by VFP before I shutdown the computer. Any idea how to rectify
> this
> issue?
>
> Here is how I connect to the computer:
> strNamespace = "root\cimv2"
>
> objWbemLocator = CreateObject("WbemScripting.SWbemLocator")
> THISFORM.objWMIService = ;
> objwbemLocator.ConnectServer(strComputer, strNamespace, strUser,
> ALLTRIM(THISFORM.Password))
> THISFORM.objWMIService.Security_.authenticationLev el
> =WbemAuthenticationLevelPktPrivacy
>
> I've tried setting THISFORM.objWMIService = NULL but that doesn't work.
>
> Beyond that I'm just doing a series of Select calls to the computer like
> this:
> THISFORM.colCompSystem = THISFORM.objWMIService.ExecQuery ("SELECT * FROM
> Win32_ComputerSystem")THISFORM.colPhysicalMemory =
> THISFORM.objWMIService.ExecQuery ("SELECT * FROM Win32_PhysicalMemory
> WHERE
> capacity > 16777216")
>
> Any suggestions?
>
> Thanks in advance,
> Linn
Do you open Visual Fox Pro with your script? Do you shut Visual Fox
Pro down at the end?
No, at this point I'm still running my scripts in VFP in the development
mode. So I start VFP, do my development work and whatever including running
this script multiple times. Then by the end of the day I will close down
VFP.
The work-around I've found is to make sure I exit the form that runs these
scripts right after performing the inventory. That way I'm assured that the
computer will still be on.
I eventually want this to be part of a larger maintenance and monitoring
program so I would like to figure out what I need to do to release this
without having to close my application.
Thanks,
Linn
|