Page 3 of 4 <1234>
Topic Options
#137890 - 2005-04-19 07:06 PM Re: Need help with EnumProcess
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11624
Loc: CA
It appears that WMI is not functioning correctly on a couple of the systems. I would look at testing them individually and repairing WMI if needed.

I'm not sure what you're trying to accomplish by sending a NET SEND to the computer for. What would that mean to the user? Most users would either ignore it, or call the Helpdesk to complain about some message that keeps showing up on their computer.

Top
#137891 - 2005-04-19 08:38 PM Re: Need help with EnumProcess
Broxoth Offline
Getting the hang of it

Registered: 2005-04-07
Posts: 78
Two things.
1) Once tested and I know where the WMI problem lies, how would I go about repairing it? I'd be more than happy to read up on doing such if someone could tell me where to find that info.
2) The whole idea behind the NET SEND was discussed earlier in the thread. The original code had a line:
Code:
$=SendMessage(@wksta,$computer +' is running '+ $proc)


I was looking to put together some pseudo-front end to the script that would just put the info I was after into a message box plainly with no more than a couple of lines. As it stands, what I'd like to see, is a messagebox that states that either, Yes, the $computer was pinged and that this $process was found to be running....or, No, this $computer was not pinged, we're moving on to the next $computer.
That's the general idea. Now, as much as I appreciate the enormous amount of help that I've received, (honestly, I have never seen so many people be so generous with their help!) I always intended on putting this thing together myself. Just saying that to make it clear that it's not like I'm expecting anyone else to do my dirty work. Thank you, everyone!

Top
#137892 - 2005-04-19 08:50 PM Re: Need help with EnumProcess
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11624
Loc: CA
Reinstalling WMI
If you experience behavior when using WMI, such as application errors or scripts that used to work are no longer working, you may have a corrupted WMI repository. To fix a corrupted WMI repository, you have to reinstall WMI.

Windows Management Instrumentation - Repair

As for the NET SEND I'm still not sure why you would send that to a user. What purpose does it serve either to you or the user? It is not logged, when the user clicks okay the message is now gone, etc..

We can setup a MessageBox command that would alert YOU as the Administrator about a system if you want which I'm guessing is more of what you're really wanting.

Top
#137893 - 2005-04-19 09:25 PM Re: Need help with EnumProcess
Broxoth Offline
Getting the hang of it

Registered: 2005-04-07
Posts: 78
Well, two more things:
1) You were dead on about the WMI. I restarted WMI on two machines that were giving me problems and they're running great now. I didn't need to delete the directories. Thanks a ton for the help there.
2) If you notice that's where the SendMessage went to, @WKSTA and I will only be running this script locally so that should never be a problem. However, I am looking at tweaking on how this script displays. A console window is ok but I'd like a nice front end eventually for this. Thanks yet again!

Top
#137894 - 2005-04-19 09:51 PM Re: Need help with EnumProcess
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Couple of things to ponder..

Does the following directory exist?
%windir%\system32\wbem

or..
Code:

$check=GetObject("winmgmts:{impersonationLevel=impersonate}!\\"+$scomputer+'\root\cimv2')
IF @error<>0
?'WMI Appears to be having trouble'
ENDIF



HTH,

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#137895 - 2005-04-19 10:07 PM Re: Need help with EnumProcess
Broxoth Offline
Getting the hang of it

Registered: 2005-04-07
Posts: 78
Good thought, kdyer. I'll consider adding that.
Here's the final code with the MessageBox implemented:
Code:
Break On
Dim $SO,$Pause
$SO=SetOption('Explicit','On')
$SO=SetOption('NoVarsInStrings','On')
$SO=SetOption('WrapAtEOL','On')

Dim $ArrayComputers, $sComputer, $Process, $Processes, $List, $Item
$ArrayComputers = 'OFF-FRONTDESK','OFF-TSINGERY','OFF-JHUFF','OFF-SGONZALEZ','OFF-HOYT','OFF-SBERGER','OFF-RLOCKWOOD'
$Processes = 'School.exe','SMinder.exe','SMAdmin.exe','SMReport.exe','SMBill.exe','Admission.exe'
For Each $sComputer in $ArrayComputers
If $sComputer
If Ping($sComputer) Goto "EnumDisplay"

:EnumDisplay
For Each $Process in $Processes
If $Process
$List = EnumProcess($Process,,$sComputer)
If $List
MessageBox($sComputer + " was pinged and is running " + $Process + " with a PID of" + $List + ".","SMChecks",0)
EndIf
EndIf
Next
EndIf
EndIf
Next



Kind of nasty with the goto statement but it gets the job done.

Top
#137896 - 2005-04-19 11:19 PM Re: Need help with EnumProcess
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11624
Loc: CA
Well if you really want a GOOD LOOKING GUI then take a look at implementing this with KiXforms written by our very own Admin/Moderator Shawn Tassie.

KiXforms Home Page

Top
#137897 - 2005-04-20 12:03 AM Re: Need help with EnumProcess
Broxoth Offline
Getting the hang of it

Registered: 2005-04-07
Posts: 78
I just bought ASE. I thought I saw something about KiXforms when I installed. Maybe it comes with it now.
Top
#137898 - 2005-04-20 02:24 AM Re: Need help with EnumProcess
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11624
Loc: CA
KiXforms is completely FREE to use. Not sure if it was included as part of the ASE install, but I think you're correct that it does install it.

Just need to visit the KiXforms site and start learning how to use it.

Top
#137899 - 2005-04-20 03:12 AM Re: Need help with EnumProcess
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Someone say Kixforms ?
Top
#137900 - 2005-04-20 04:05 AM Re: Need help with EnumProcess
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
You would want ot go with the latest dev build anyway and not the latest gold.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#137901 - 2005-04-20 03:44 PM Re: Need help with EnumProcess
Broxoth Offline
Getting the hang of it

Registered: 2005-04-07
Posts: 78
Why's that, Les?
Top
#137902 - 2005-04-20 04:05 PM Re: Need help with EnumProcess
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Cuz the latest Gold is buggy but Shawn refused to pull it, and since then he added soo much good stuff since but he can't decide when to cutoff dev and release it as Gold.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#137903 - 2005-04-20 11:09 PM Re: Need help with EnumProcess
Broxoth Offline
Getting the hang of it

Registered: 2005-04-07
Posts: 78
OK. I'm working on that front-end as we speak. However, I think I may be in over my head. I'm not a coder by trade (as if it doesn't show) and I'm at a complete loss. I suppose I'll just post on the KiXforms board and try to get some help there. Thanks everyone.
Top
#137904 - 2005-04-20 11:18 PM Re: Need help with EnumProcess
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Here, there, doesn't matter - we're all one big happy Kixtart community.
Top
#137905 - 2005-04-20 11:38 PM Re: Need help with EnumProcess
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
They are a snooty bunch over there... always getting their knickers in a twist. The ones that really matter hang here as well.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#137906 - 2005-04-21 12:05 AM Re: Need help with EnumProcess
Broxoth Offline
Getting the hang of it

Registered: 2005-04-07
Posts: 78
Would it be ok then to repost what I posted there, here?
Top
#137907 - 2005-04-21 12:15 AM Re: Need help with EnumProcess
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
No, I think once you pick your venue, you should stick to it. Some people get annoyed if you cross post between boards.

You could post a link though in this thread to help guide people to your topic there.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#137908 - 2005-04-21 12:22 AM Re: Need help with EnumProcess
Broxoth Offline
Getting the hang of it

Registered: 2005-04-07
Posts: 78
As a board moderator elsewhere, I fully understand. Wish I'd asked before I posted. Would've made more sense to keep the conversation rolling on this thread. Oh well, here's the link.
Top
#137909 - 2005-04-21 01:45 AM Re: Need help with EnumProcess
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Here is some thoughts ... might want to use the ListBox instead of Textboxes - idk - its your call, here is some code based on Listboxes though ...

Code:

Break On
;SetConsole("hide")

$System = CreateObject("Kixtart.System")

;KD START

$Form = $System.Form()
$Form.BackColor = 224,223,227
$Form.Height = 477
$Form.Left = 209
$Form.MaximizeBox = "False"
$Form.Text = "SM Process Checker"
$Form.Top = 89
$Form.Width = 532
$UI_COMPNAMES = $Form.Controls.ListBox()
$UI_COMPNAMES.Height = 150
$UI_COMPNAMES.Left = 15
$UI_COMPNAMES.Text = ""
$UI_COMPNAMES.Top = 45
$UI_COMPNAMES.Width = 150
$UI_COMPNAMES.Sorted = 1

$COMPNAME_LABEL = $Form.Controls.Label()
$COMPNAME_LABEL.BackColor = 224,223,227
$COMPNAME_LABEL.FontBold = "True"
$COMPNAME_LABEL.FontUnderline = "True"
$COMPNAME_LABEL.Height = 20
$COMPNAME_LABEL.Left = 15
$COMPNAME_LABEL.Text = "Computer Name(s)"
$COMPNAME_LABEL.Top = 30
$COMPNAME_LABEL.Width = 114

$PROCGROUP = $Form.Controls.GroupBox()
$PROCGROUP.BackColor = 224,223,227
$PROCGROUP.Height = 141
$PROCGROUP.Left = 15
$PROCGROUP.Text = "Processes to Search For:"
$PROCGROUP.Top = 202
$PROCGROUP.Width = 268

$UI_SCHOOL = $PROCGROUP.Controls.CheckBox()
$UI_SCHOOL.BackColor = 224,223,227
$UI_SCHOOL.CheckAlign = 16
$UI_SCHOOL.Height = 24
$UI_SCHOOL.Left = 15
$UI_SCHOOL.Text = "School.exe"
$UI_SCHOOL.Top = 15
$UI_SCHOOL.Width = 104

$UI_SMINDER = $PROCGROUP.Controls.CheckBox()
$UI_SMINDER.BackColor = 224,223,227
$UI_SMINDER.CheckAlign = 16
$UI_SMINDER.Height = 24
$UI_SMINDER.Left = 15
$UI_SMINDER.Text = "SMinder.exe"
$UI_SMINDER.Top = 45
$UI_SMINDER.Width = 104

$UI_SMADMIN = $PROCGROUP.Controls.CheckBox()
$UI_SMADMIN.BackColor = 224,223,227
$UI_SMADMIN.CheckAlign = 16
$UI_SMADMIN.Height = 24
$UI_SMADMIN.Left = 15
$UI_SMADMIN.Text = "SMAdmin.exe"
$UI_SMADMIN.Top = 75
$UI_SMADMIN.Width = 104

$UI_SMREPORT = $PROCGROUP.Controls.CheckBox()
$UI_SMREPORT.BackColor = 224,223,227
$UI_SMREPORT.CheckAlign = 16
$UI_SMREPORT.Height = 24
$UI_SMREPORT.Left = 135
$UI_SMREPORT.Text = "SMReport.exe"
$UI_SMREPORT.Top = 15
$UI_SMREPORT.Width = 104

$UI_SMBILL = $PROCGROUP.Controls.CheckBox()
$UI_SMBILL.BackColor = 224,223,227
$UI_SMBILL.CheckAlign = 16
$UI_SMBILL.Height = 24
$UI_SMBILL.Left = 135
$UI_SMBILL.Text = "SMBill.exe"
$UI_SMBILL.Top = 45
$UI_SMBILL.Width = 104

$UI_ADMISSION = $PROCGROUP.Controls.CheckBox()
$UI_ADMISSION.BackColor = 224,223,227
$UI_ADMISSION.CheckAlign = 16
$UI_ADMISSION.Height = 24
$UI_ADMISSION.Left = 135
$UI_ADMISSION.Text = "Admission.exe"
$UI_ADMISSION.Top = 75
$UI_ADMISSION.Width = 104

$UI_ALLPROCS = $PROCGROUP.Controls.CheckBox()
$UI_ALLPROCS.BackColor = 224,223,227
$UI_ALLPROCS.CheckAlign = 16
$UI_ALLPROCS.FontItalic = "True"
$UI_ALLPROCS.Height = 21
$UI_ALLPROCS.Left = 75
$UI_ALLPROCS.Text = "Search for ALL"
$UI_ALLPROCS.Top = 105
$UI_ALLPROCS.Width = 105

$COMPLIST_LABEL = $Form.Controls.Label()
$COMPLIST_LABEL.BackColor = 224,223,227
$COMPLIST_LABEL.FontBold = "True"
$COMPLIST_LABEL.FontUnderline = "True"
$COMPLIST_LABEL.Height = 17
$COMPLIST_LABEL.Left = 270
$COMPLIST_LABEL.Text = "Search these computers:"
$COMPLIST_LABEL.Top = 30
$COMPLIST_LABEL.Width = 144

$UI_MOVETOLIST = $Form.Controls.Button()
$UI_MOVETOLIST.FontBold = "True"
$UI_MOVETOLIST.Height = 28
$UI_MOVETOLIST.Left = 205
$UI_MOVETOLIST.Text = ">>"
$UI_MOVETOLIST.Top = 60
$UI_MOVETOLIST.Width = 30
$UI_MOVETOLIST.OnClick = "MoveToListClick()"

$UI_MOVEFROMLIST = $Form.Controls.Button()
$UI_MOVEFROMLIST.FontBold = "True"
$UI_MOVEFROMLIST.Height = 28
$UI_MOVEFROMLIST.Left = 205
$UI_MOVEFROMLIST.Text = "<<"
$UI_MOVEFROMLIST.Top = 120
$UI_MOVEFROMLIST.Width = 30
$UI_MOVEFROMLIST.OnClick = "MoveFromListClick()"

$UI_SEARCHBUTTON = $Form.Controls.Button()
$UI_SEARCHBUTTON.FontBold = "True"
$UI_SEARCHBUTTON.Height = 23
$UI_SEARCHBUTTON.Left = 315
$UI_SEARCHBUTTON.Text = "Search"
$UI_SEARCHBUTTON.Top = 210
$UI_SEARCHBUTTON.Width = 75

$UI_CLEARLISTBUTTON = $Form.Controls.Button()
$UI_CLEARLISTBUTTON.Height = 23
$UI_CLEARLISTBUTTON.Left = 180
$UI_CLEARLISTBUTTON.Text = "Clear list"
$UI_CLEARLISTBUTTON.Top = 165
$UI_CLEARLISTBUTTON.Width = 75
$UI_CLEARLISTBUTTON.OnClick = "ClearListClick()"

$UI_CLEARALLBUTTON = $Form.Controls.Button()
$UI_CLEARALLBUTTON.Height = 23
$UI_CLEARALLBUTTON.Left = 315
$UI_CLEARALLBUTTON.Text = "Clear ALL"
$UI_CLEARALLBUTTON.Top = 255
$UI_CLEARALLBUTTON.Width = 75

$UI_CLOSEBUTTON = $Form.Controls.Button()
$UI_CLOSEBUTTON.Height = 23
$UI_CLOSEBUTTON.Left = 315
$UI_CLOSEBUTTON.Text = "Close"
$UI_CLOSEBUTTON.Top = 300
$UI_CLOSEBUTTON.Width = 75

$UI_COMPLIST = $Form.Controls.ListBox()
$UI_COMPLIST.Height = 150
$UI_COMPLIST.Left = 270
$UI_COMPLIST.ReadOnly = "True"
$UI_COMPLIST.Top = 45
$UI_COMPLIST.Width = 150
$UI_COMPLIST.Sorted = 1

;KD END

For $i = 0 To 100
$UI_COMPNAMES.AddItem("HOST#$i")
Next

$Form.Show
While $Form.Visible
$=Execute($Form.DoEvents())
Loop
Exit 1

Function MoveToListClick()

If $UI_COMPNAMES.ListIndex <> -1
$UI_COMPLIST.AddItem($UI_COMPNAMES.Text)
$UI_COMPNAMES.RemoveItem($UI_COMPNAMES.ListIndex)
Endif

EndFunction

Function MoveFromListClick()

If $UI_COMPLIST.ListIndex <> -1
$UI_COMPNAMES.AddItem($UI_COMPLIST.Text)
$UI_COMPLIST.RemoveItem($UI_COMPLIST.ListIndex)
Endif

EndFunction

Function ClearListClick()

$UI_COMPLIST.Clear

EndFunction


Top
Page 3 of 4 <1234>


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 920 anonymous users online.
Newest Members
Timothy, Jojo67, MaikSimon, kvn317, kixtarts2025
17874 Registered Users

Generated in 0.077 seconds in which 0.028 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org