Page 1 of 1 1
Topic Options
#77318 - 2003-11-04 05:30 PM Kixforms Message server
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
I only have the 'User list' portion running in this early alpha stage... it is a comma delimited list of PC names. However, the OU list and group list do function, it just doesn't enum the PCs from the group yet

 -
requires (in @scriptdir) if you need/want to install the client service remotely: instsrv.exe, srvany.exe, wkix32.exe, kixforms.dll, and MRC.kix (the client)

Server and Targets need WMI to install the client service remotely

Break On
;********* FORM CREATE BEGIN **********
$Form = CreateObject('Kixtart.Form')
$Form.BackColor = 212,208,200
$Form.ControlBox = "True"
$Form.DrawGrid = "True"
$Form.FontBold = "False"
$Form.FontItalic = "False"
$Form.FontName = "Microsoft Sans Serif"
$Form.FontSize = 8.25
$Form.FontUnderline = "False"
$Form.ForeColor = 0,0,0
$Form.FormBorderStyle = 4
$Form.Height = 406
$Form.Left = 0
$Form.MaximizeBox = "False"
$Form.MinimizeBox = "True"
$Form.SizeGripStyle = 0
$Form.StartPosition = 4
$Form.Tag = ""
$Form.Text = "Message Control Center"
$Form.Top = 0
$Form.ToolTipText = ""
$Form.TopMost = "False"
$Form.Width = 460
$Form.WindowState = 0
;********* FORM CREATE END **********

;************* GROUPBOX1 **************
$GroupBox1 = $Form.Controls.GroupBox
$GroupBox1.Anchor = 13
$GroupBox1.BackColor = 212,208,200
$GroupBox1.Enabled = "True"
$GroupBox1.FlatStyle = 2
$GroupBox1.FontBold = "False"
$GroupBox1.FontItalic = "False"
$GroupBox1.FontName = "Microsoft Sans Serif"
$GroupBox1.FontSize = 8.25
$GroupBox1.FontUnderline = "False"
$GroupBox1.ForeColor = 0,0,0
$GroupBox1.Height = 79
$GroupBox1.Left = 15
$GroupBox1.Tag = ""
$GroupBox1.Text = "Recipients"
$GroupBox1.Top = 15
$GroupBox1.Visible = "True"
$GroupBox1.Width = 423
;*************************************

;************* RADIOBUTTON1 **************
$RadioButton1 = $GroupBox1.Controls.RadioButton
$RadioButton1.Anchor = 0
$RadioButton1.BackColor = 212,208,200
$RadioButton1.Checked = "False"
$RadioButton1.Enabled = "True"
$RadioButton1.FlatStyle = 2
$RadioButton1.ForeColor = 0,0,0
$RadioButton1.Height = 22
$RadioButton1.FontBold = "False"
$RadioButton1.FontItalic = "False"
$RadioButton1.FontName = "Microsoft Sans Serif"
$RadioButton1.FontSize = 8.25
$RadioButton1.FontUnderline = "False"
$RadioButton1.Left = 15
$RadioButton1.TabStop = "True"
$RadioButton1.Tag = ""
$RadioButton1.Text = "OU"
$RadioButton1.Top = 15
$RadioButton1.Visible = "True"
$RadioButton1.Width = 40
$RadioButton1.onclick = "OUEntry()"
;*************************************

;************* RADIOBUTTON2 **************
$RadioButton2 = $GroupBox1.Controls.RadioButton
$RadioButton2.Anchor = 0
$RadioButton2.BackColor = 212,208,200
$RadioButton2.Checked = "False"
$RadioButton2.Enabled = "True"
$RadioButton2.FlatStyle = 2
$RadioButton2.ForeColor = 0,0,0
$RadioButton2.Height = 21
$RadioButton2.FontBold = "False"
$RadioButton2.FontItalic = "False"
$RadioButton2.FontName = "Microsoft Sans Serif"
$RadioButton2.FontSize = 8.25
$RadioButton2.FontUnderline = "False"
$RadioButton2.Left = 165
$RadioButton2.TabStop = "False"
$RadioButton2.Tag = ""
$RadioButton2.Text = "Group"
$RadioButton2.Top = 15
$RadioButton2.Visible = "True"
$RadioButton2.Width = 54
$RadioButton2.onclick = "GroupEntry()"
;*************************************

;************* RADIOBUTTON3 **************
$RadioButton3 = $GroupBox1.Controls.RadioButton
$RadioButton3.Anchor = 5
$RadioButton3.BackColor = 212,208,200
$RadioButton3.Checked = "True"
$RadioButton3.Enabled = "True"
$RadioButton3.FlatStyle = 2
$RadioButton3.ForeColor = 0,0,0
$RadioButton3.Height = 20
$RadioButton3.FontBold = "False"
$RadioButton3.FontItalic = "False"
$RadioButton3.FontName = "Microsoft Sans Serif"
$RadioButton3.FontSize = 8.25
$RadioButton3.FontUnderline = "False"
$RadioButton3.Left = 315
$RadioButton3.TabStop = "False"
$RadioButton3.Tag = ""
$RadioButton3.Text = "User List"
$RadioButton3.Top = 15
$RadioButton3.Visible = "True"
$RadioButton3.Width = 67
$RadioButton3.onclick = "ManualEntry()"
;*************************************

;************* COMBOBOX1 **************
$ComboBox1 = $GroupBox1.Controls.ComboBox
$ComboBox1.Anchor = 13
$ComboBox1.DropDownStyle = 1
$ComboBox1.DropDownWidth = 395
$ComboBox1.Enabled = "True"
$ComboBox1.FontBold = "False"
$ComboBox1.FontItalic = "False"
$ComboBox1.FontName = "Microsoft Sans Serif"
$ComboBox1.FontSize = 8.25
$ComboBox1.FontUnderline = "False"
$ComboBox1.Height = 21
$ComboBox1.Left = 15
$ComboBox1.Sorted = "False"
$ComboBox1.TabStop = "True"
$ComboBox1.Tag = ""
$ComboBox1.Top = 45
$ComboBox1.Visible = "True"
$ComboBox1.Width = 400
;*************************************

;************* TEXTBOX1 **************
$TextBox1 = $Form.Controls.TextBox
$TextBox1.Anchor = 13
$TextBox1.AcceptsReturn = "False"
$TextBox1.AcceptsTab = "False"
$TextBox1.BackColor = 255,255,255
$TextBox1.BorderStyle = 2
$TextBox1.Enabled = "True"
$TextBox1.FontBold = "False"
$TextBox1.FontItalic = "False"
$TextBox1.FontName = "Microsoft Sans Serif"
$TextBox1.FontSize = 8.25
$TextBox1.FontUnderline = "False"
$TextBox1.ForeColor = 0,0,0
$TextBox1.Height = 20
$TextBox1.HideSelection = "True"
$TextBox1.Left = 30
$TextBox1.MaxLength = 32767
$TextBox1.Multiline = "False"
$TextBox1.PasswordChar = ""
$TextBox1.ReadOnly = "False"
$TextBox1.ScrollBars = 0
$TextBox1.TabStop = "True"
$TextBox1.Tag = ""
$TextBox1.Text = "Message from Information Technology"
$TextBox1.TextAlign = 0
$TextBox1.Top = 135
$TextBox1.Visible = "True"
$TextBox1.Width = 400
$TextBox1.WordWrap = "True"
;*************************************

;************* LABEL1 **************
$Label1 = $Form.Controls.Label
$Label1.Anchor = 5
$Label1.BackColor = 212,208,200
$Label1.BorderStyle = 0
$Label1.Enabled = "True"
$Label1.FlatStyle = 2
$Label1.FontBold = "False"
$Label1.FontItalic = "False"
$Label1.FontName = "Microsoft Sans Serif"
$Label1.FontSize = 8.25
$Label1.FontUnderline = "False"
$Label1.ForeColor = 0,0,0
$Label1.Height = 16
$Label1.Left = 22
$Label1.Tag = ""
$Label1.Text = "Title"
$Label1.ToolTipText = ""
$Label1.Top = 120
$Label1.Visible = "True"
$Label1.Width = 41
;*************************************

;************* LABEL2 **************
$Label2 = $Form.Controls.Label
$Label2.Anchor = 5
$Label2.BackColor = 212,208,200
$Label2.BorderStyle = 0
$Label2.Enabled = "True"
$Label2.FlatStyle = 2
$Label2.FontBold = "False"
$Label2.FontItalic = "False"
$Label2.FontName = "Microsoft Sans Serif"
$Label2.FontSize = 8.25
$Label2.FontUnderline = "False"
$Label2.ForeColor = 0,0,0
$Label2.Height = 16
$Label2.Left = 22
$Label2.Tag = ""
$Label2.Text = "Message"
$Label2.ToolTipText = ""
$Label2.Top = 165
$Label2.Visible = "True"
$Label2.Width = 52
;*************************************

;************* TEXTBOX2 **************
$TextBox2 = $Form.Controls.TextBox
$TextBox2.Anchor = 15
$TextBox2.AcceptsReturn = "False"
$TextBox2.AcceptsTab = "False"
$TextBox2.BackColor = 255,255,255
$TextBox2.BorderStyle = 2
$TextBox2.Enabled = "True"
$TextBox2.FontBold = "False"
$TextBox2.FontItalic = "False"
$TextBox2.FontName = "Microsoft Sans Serif"
$TextBox2.FontSize = 8.25
$TextBox2.FontUnderline = "False"
$TextBox2.ForeColor = 0,0,0
$TextBox2.Height = 110
$TextBox2.HideSelection = "True"
$TextBox2.Left = 30
$TextBox2.MaxLength = 32767
$TextBox2.Multiline = "True"
$TextBox2.PasswordChar = ""
$TextBox2.ReadOnly = "False"
$TextBox2.ScrollBars = 3
$TextBox2.TabStop = "True"
$TextBox2.Tag = ""
$TextBox2.Text = ""
$TextBox2.TextAlign = 0
$TextBox2.Top = 180
$TextBox2.Visible = "True"
$TextBox2.Width = 400
$TextBox2.WordWrap = "True"
;*************************************

;************* LABEL3 **************
$Label3 = $Form.Controls.Label
$Label3.Anchor = 6
$Label3.BackColor = 212,208,200
$Label3.BorderStyle = 0
$Label3.Enabled = "True"
$Label3.FlatStyle = 2
$Label3.FontBold = "False"
$Label3.FontItalic = "False"
$Label3.FontName = "Microsoft Sans Serif"
$Label3.FontSize = 8.25
$Label3.FontUnderline = "False"
$Label3.ForeColor = 0,0,0
$Label3.Height = 15
$Label3.Left = 22
$Label3.Tag = ""
$Label3.Text = "Log File"
$Label3.ToolTipText = ""
$Label3.Top = 300
$Label3.Visible = "True"
$Label3.Width = 55
;*************************************

;************* TEXTBOX3 **************
$TextBox3 = $Form.Controls.TextBox
$TextBox3.Anchor = 14
$TextBox3.AcceptsReturn = "False"
$TextBox3.AcceptsTab = "False"
$TextBox3.BackColor = 255,255,255
$TextBox3.BorderStyle = 2
$TextBox3.Enabled = "True"
$TextBox3.FontBold = "False"
$TextBox3.FontItalic = "False"
$TextBox3.FontName = "Microsoft Sans Serif"
$TextBox3.FontSize = 8.25
$TextBox3.FontUnderline = "False"
$TextBox3.ForeColor = 0,0,0
$TextBox3.Height = 20
$TextBox3.HideSelection = "True"
$TextBox3.Left = 30
$TextBox3.MaxLength = 32767
$TextBox3.Multiline = "False"
$TextBox3.PasswordChar = ""
$TextBox3.ReadOnly = "False"
$TextBox3.ScrollBars = 0
$TextBox3.TabStop = "True"
$TextBox3.Tag = ""
$TextBox3.Text = "\\a06\logon\inventory\mcc.ini"
$TextBox3.TextAlign = 0
$TextBox3.Top = 315
$TextBox3.Visible = "True"
$TextBox3.Width = 380
$TextBox3.WordWrap = "True"
;*************************************

;************* BUTTON1 **************
$Button1 = $Form.Controls.Button
$Button1.Anchor = 10
$Button1.TextAlign = 32
$Button1.Enabled = "True"
$Button1.FlatStyle = 2
$Button1.FontBold = "False"
$Button1.FontItalic = "False"
$Button1.FontName = "Microsoft Sans Serif"
$Button1.FontSize = 8.25
$Button1.FontUnderline = "False"
$Button1.ForeColor = 0,0,0
$Button1.Height = 21
$Button1.Left = 410
$Button1.TabStop = "True"
$Button1.Tag = ""
$Button1.Text = "..."
$Button1.ToolTipText = ""
$Button1.Top = 315
$Button1.Visible = "True"
$Button1.Width = 18
;*************************************

;************* SEND **************
$Send = $Form.Controls.Button
$Send.Anchor = 10
$Send.TextAlign = 32
$Send.Enabled = "True"
$Send.FlatStyle = 2
$Send.FontBold = "False"
$Send.FontItalic = "False"
$Send.FontName = "Microsoft Sans Serif"
$Send.FontSize = 8.25
$Send.FontUnderline = "False"
$Send.ForeColor = 0,0,0
$Send.Height = 23
$Send.Left = 360
$Send.TabStop = "True"
$Send.Tag = ""
$Send.Text = "Send"
$Send.ToolTipText = ""
$Send.Top = 345
$Send.Visible = "True"
$Send.Width = 75
$Send.onclick = "Send()"
;*************************************

$PForm = CreateObject("Kixtart.Form")
$PForm.Width = 250
$PForm.Height = 60
$PForm.BorderStyle = 3
$PForm.Center

$PBar = $PForm.ProgressBar
$PBar.Size = 230,15
$PBar.Style = "1"
$PBar.Center
$PBar.Max = 20

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

Function Send()
del @scriptdir+'\message.txt'
$f = freefilehandle
$ = open($f,@scriptdir+'\message.txt',5)
$ = writeline($f,$TextBox1.Text+@crlf)
$ = writeline($f,$TextBox2.Text+@crlf)
$ = writeline($f,$TextBox3.Text+@crlf)
$ = close($f)
select
case $RadioButton1.Checked

case $RadioButton2.Checked

case $RadioButton3.Checked
$computers = Split($ComboBox1.text,',')
endselect

for each $pc in $computers
$pc = trim($pc)
if WSHPing($pc)[0] > 0
If IdentifyUser($pc)
If not exist('\\'+$pc+'\c$$\winnt\system32\mrc.kix') or not exist('\\'+$pc+'\c$$\winnt\system32\kixforms.dll')
copy @scriptdir+'\mrc.kix' '\\'+$pc+'\c$$\winnt\system32\'
copy @scriptdir+'\wkix32.exe' '\\'+$pc+'\c$$\winnt\system32\'
copy @scriptdir+'\srvany.exe' '\\'+$pc+'\c$$\winnt\system32\'
copy @scriptdir+'\instsrv.exe' '\\'+$pc+'\c$$\winnt\system32\'
copy @scriptdir+'\kixforms.dll' '\\'+$pc+'\c$$\winnt\system32\'
$ = RMTEXEC($pc, 'regsvr32 /s %windir%\system32\kixforms.dll')
endif
$MC = WMIService("MessageClient","Start","Automatic",$pc)
if $MC <> 'Running|Auto'
$ = RMTEXEC($pc, 'instsrv MessageClient %windir%\system32\srvany.exe')
$PCHKLMSCCSSMC = '\\'+$pc+'\HKLM\SYSTEM\CurrentControlSet\Services\MessageClient'
$ = writevalue($PCHKLMSCCSSMC,'Start','2',REG_DWORD)
$ = writevalue($PCHKLMSCCSSMC,'type','272',REG_DWORD)
$ = writevalue($PCHKLMSCCSSMC + '\Parameters','Application','%windir%\system32\wkix32.exe',REG_SZ)
$ = writevalue($PCHKLMSCCSSMC + '\Parameters','AppParameters','%windir%\system32\mrc.kix',REG_SZ)
$MC = WMIService("MessageClient","Start","Automatic",$pc)
endif
copy @scriptdir+'\message.txt' '\\'+$pc+'\c$$'
$status= iif(@error,'Error','Sent')
$ = writeprofilestring($TextBox3.Text,$TextBox1.Text,$pc,$status)
else
$ = writeprofilestring($TextBox3.Text,'Not In Use',$pc,@time)
endif
else
$ = writeprofilestring($TextBox3.Text,'Offline',$pc,@time)
endif
next
del @scriptdir+'\message.txt'
EndFunction
; **************************
Function OUEntry()

$PBar.Value = 0 ;for progress bar only
$ComboBox1.clear
$PForm.Caption = "Loading AD Domain Information..."
$PForm.Show
$ldap="LDAP://"+@domain+"/"+GetObject("LDAP://rootDSE").Get("defaultNamingContext")
$ou = EnumOUs($ldap, 'computer')
for each $item in split($ou,"|")
$ComboBox1.AddItem($item)
next
$PForm.Hide
EndFunction
; **************************
Function GroupEntry()

$PBar.Value = 0 ;for progress bar only
$ComboBox1.clear
$PForm.Caption = "Loading Group Information..."
$PForm.Show
$groups = EnumGroups()
for each $item in $groups
$ComboBox1.AddItem($item)
next
$PForm.Hide

EndFunction
; **************************
Function ManualEntry()


EndFunction
;**********************************************************************************************************************
Function EnumGroups()
dim $domain, $group, $groups
$domain = getobject("WinNT://@domain")
$domain.filter = "group",""
for each $group in $domain
$PBar.Value = iif($PBar.Value < $PBar.Max,$PBar.Value + 1,0) ;for progress bar only
$groups = $groups + '|' + $group.name
next
$domain = 0
$EnumGroups = split(substr($groups,2),'|')
EndFunction
;**********************************************************************************************************************
Function EnumOUs($LDAP, $Filter)
dim $aFilter[0], $pos, $objOU, $i, $j

if $Filter <> 'user'
$Filter = 'computer'
endif
$objOU = GetObject($LDAP)
if VarTypeName($objOU)='Object'
$aFilter[0] = $Filter
$objOU.Filter = $aFilter
for each $item in $objOU
$PBar.Value = iif($PBar.Value < $PBar.Max,$PBar.Value + 1,0) ;for progress bar only
if $item.class = $Filter
$i = $LDAP
endif
next
$aFilter[0] = "organizationalUnit"
$objOU.Filter = $aFilter
for each $item in $objOU
$PBar.Value = iif($PBar.Value < $PBar.Max,$PBar.Value + 1,0) ;for progress bar only
$Name = $item.Name
$pos = instrrev($LDAP,"/")
$DN = Left($LDAP,$pos) + $Name + ", " + substr($LDAP, $pos+1)
$j = EnumOUs($DN, $Filter)
if $j
$i = iif($i,$i +"|"+ $j,$j)
endif
next
endif
$EnumOUs = $i
Endfunction
;**********************************************************************************************************************
Function IdentifyUser(optional $Computer)
dim $objWMIService, $colComputer
if not $computer>' ' $computer='.' endif
$computer = substr($computer,instrrev($computer,'\')+1)
$objWMIService = GetObject("winmgmts:" + "{impersonationLevel=impersonate}!\\" + $Computer + "\root\cimv2")
if not $objWMIService exit 1 endif
$colComputer = $objWMIService.ExecQuery ("Select * from Win32_ComputerSystem")
For Each $objComputer in $colComputer
$IdentifyUser = $objComputer.UserName
Next
EndFunction
;**********************************************************************************************************************
FUNCTION RMTEXEC($computer, $command)
dim $Connect
$Connect = GetObject("winmgmts:{impersonationLevel=impersonate}!//"+$computer+"/root/cimv2:Win32_Process")
$RMTEXEC = $Connect.Create($Command)
exit @error
$Connect = 0
ENDFUNCTION
;**********************************************************************************************************************
FUNCTION WSHPing($Computer,optional $replies)
dim $ip, $l, $r, $count, $return, $line ,$pos, $avg
if not $replies $replies=1 endif
$ip=$computer $Count=0
$shell='%comspec% /c %windir%\system32\ping $Computer -n $replies '
$return=WSHPipe($shell,1)
if not @error
for each $line in $return
select
case instr($line,"[") $ip=split(split($line,'[')[1],']')[0]
case instr($line,"reply from") $Count=$Count+1
case instr($line,"Average") $pos=instr($line,"Average")+8
$avg=val(right("$line",len($line)-$pos))
endselect
if instr($line,"timed out") $Count=$Count-1 endif
next
$WSHPing=$ip,$count,$avg
else
$WSHPing="0.0.0.0","0","0"
exit(487)
endif
ENDFUNCTION
;****************************************************************************************************
Function WshPipe($ShellCMD, OPTIONAL $NoEcho)
Dim $WshShell, $oExec, $AllOutput, $Exit, $WshExitCode
$WshErrorMsg=""
$WshShell=CreateObject("WScript.Shell")
$oExec=$WshShell.Exec($ShellCMD)
While $Exit<>1
Dim $Output
Select
Case Not $oExec.StdOut.AtEndOfStream $Output=$oExec.StdOut.ReadAll
Case Not $oExec.StdErr.AtEndOfStream $Output=$oExec.StdErr.ReadAll
$WshErrorMsg = $Output
Case 1 $Output=-1
EndSelect
If $Output=-1
If $oExec.Status=1 $Exit=1 Endif
Else
If $NoEcho<>1 ? $Output Endif
$AllOutput = $AllOutput + $Output
Endif
Loop
$WshExitCode=$oExec.ExitCode
$WshPipe=split($AllOutput,chr(10))
Exit($WshExitCode)
EndFunction
;*************************************************************************************************************************
function WMIService($service,optional $action,optional $startmode,optional $computer)
Dim $wmi,$svc,$services,$sm,$st

if not $computer $computer=@wksta endif
$wmi=getobject("winmgmts:{impersonationlevel=impersonate}!//$computer")
$services=$wmi.ExecQuery("Select * from Win32_Service where name = '$service'")
if $services
for each $svc in $services
If instr("AUTOMATIC,MANUAL,DISABLED",$startmode)
$ = $svc.ChangeStartMode($startmode)
endif
if $svc.State <> $action
select
case $action = "START" $ = $svc.StartService()
case $action = "STOP" $ = $svc.StopService()
case $action = "PAUSE" $ = $svc.PauseService()
case $action = "RESUME" $ = $svc.ResumeService()
endselect
endif
next
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#77319 - 2004-09-09 04:35 PM Re: Kixforms Message server
JensKalski Offline
Starting to like KiXtart

Registered: 2000-12-13
Posts: 186
Loc: Germany
I think, there is something missing at the end. Is there a link to the complete source anywhere?
_________________________
Jens Kalski

Top
#77320 - 2004-09-10 08:12 AM Re: Kixforms Message server
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
umm ... yeah, Conrad, which version of PostPrep did you use for this post ?
_________________________



Top
#77321 - 2004-09-10 08:42 AM Re: Kixforms Message server
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
not about postprep.
the board post limitation that someone hasn't removed results in these kind of posts.
_________________________
!

download KiXnet

Top
#77322 - 2004-09-10 08:58 AM Re: Kixforms Message server
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
is it ?

This post consists of not more than 1160 lines ... wtf ?
_________________________



Top
#77323 - 2004-09-10 09:06 AM Re: Kixforms Message server
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
just believe me.
will not go proving it once again.
_________________________
!

download KiXnet

Top
Page 1 of 1 1


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

Who's Online
0 registered and 879 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.122 seconds in which 0.064 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