Page 1 of 1 1
Topic Options
#156694 - 2006-02-06 12:33 PM disabling sound on mass (scripts/forms)
Stephen Wintle Offline
Seasoned Scripter

Registered: 2001-04-10
Posts: 444
Loc: England
Hi all,

I am using a combination of exe and script to be able to mute the sound control on remote pcs. The script below works although i'm aware it isn't very tidy and help with with would be much appreciated...

Another problem that I have is that I want my Teachers to be able to change passwords, now I am using the form from kixforms that works fine, only the thing is it works only if your are Domain admins. Is there anyway I can pass Domain admin or user credentials in my script so that the person has elevated
rights?

Many thanks

<

Code:
Break On 

Setconsole("hide")

$Form = CreateObject("Kixtart.Form")
$Form.Text = "Disable sound -By S. Wintle"
$Form.Size = 330,490
$Form.BackColor = 186,218,240
;$Image = $Form.Image("\\harry\netlogon\holte1.bmp",200,20,60,60)
$TextBox = $Form.TextBox("",150,100,80,20)
$Listbox = $Form.ListBox("",20,100,80,80)
$ListBox.OnClick = "ListBox_Click()"
$Label = $Form.Label("Click on a class room to enable or disable PC
sound.",20,10,150,30)
$ListBox.List = "ICT1","ICT2","ICT3","LIBRARY","DT2","Multi","music"
$Label1 = $Form.Label("The following rooms below are
disabled.",20,200,150,30)


$Button1 = $Form.Button("Disable PC sound",10,340,120,40)
$Button2 = $Form.Button("Enable PC sound" ,150,340,120,40)
$ExitButton = $Form.Button("Exit",85,410,110,40)


$ExitButton.onClick = "Quit()"
$Button1.OnClick = "Button1_Click()"
$Button2.onClick = "Button2_Click()"



$Form.Center
$Form.Show

While $Form.Visible
$=Execute($Form.DoEvents)
Loop
Quit()

Function ListBox_Click
$TextBox.Text = $ListBox.Value
EndFunction


Function Button1_Click

$cont = MessageBox("sound disabled OK?", "KiXtart", 36)

If $cont = 6
Endif

SELECT


CASE $TextBox.Value = "ICT1"

;Run "c:\winnt\system32\beyondexecv2 \\ICT1-01 c:\winnt\nircmd.exe
mutesysvolume 1"
;Run "c:\winnt\system32\beyondexecv2 \\ICT1-02 c:\winnt\nircmd.exe
mutesysvolume 1"
;Run "c:\winnt\system32\beyondexecv2 \\ICT1-03 c:\winnt\nircmd.exe
mutesysvolume 1"
;Run "c:\winnt\system32\beyondexecv2 \\ICT1-04 c:\winnt\nircmd.exe
mutesysvolume 1"
;Run "c:\winnt\system32\beyondexecv2 \\ICT1-05 c:\winnt\nircmd.exe
mutesysvolume 1"
;Run "c:\winnt\system32\beyondexecv2 \\ICT1-06 c:\winnt\nircmd.exe
mutesysvolume 1"
;Run "c:\winnt\system32\beyondexecv2 \\ICT1-07 c:\winnt\nircmd.exe
mutesysvolume 1"
;Run "c:\winnt\system32\beyondexecv2 \\ICT1-08 c:\winnt\nircmd.exe
mutesysvolume 1"
;Run "c:\winnt\system32\beyondexecv2 \\ICT1-09 c:\winnt\nircmd.exe
mutesysvolume 1"
;Run "c:\winnt\system32\beyondexecv2 \\ICT1-10 c:\winnt\nircmd.exe
mutesysvolume 1"
;Run "c:\winnt\system32\beyondexecv2 \\ICT1-11 c:\winnt\nircmd.exe
mutesysvolume 1"
;Run "c:\winnt\system32\beyondexecv2 \\ICT1-12 c:\winnt\nircmd.exe
mutesysvolume 1"
;Run "c:\winnt\system32\beyondexecv2 \\ICT1-13 c:\winnt\nircmd.exe
mutesysvolume 1"
;Run "c:\winnt\system32\beyondexecv2 \\ICT1-14 c:\winnt\nircmd.exe
mutesysvolume 1"
;Run "c:\winnt\system32\beyondexecv2 \\ICT1-15 c:\winnt\nircmd.exe
mutesysvolume 1"
;Run "c:\winnt\system32\beyondexecv2 \\ICT1-16 c:\winnt\nircmd.exe
mutesysvolume 1"
;Run "c:\winnt\system32\beyondexecv2 \\ICT1-17 c:\winnt\nircmd.exe
mutesysvolume 1"
;Run "c:\winnt\system32\beyondexecv2 \\ICT1-18 c:\winnt\nircmd.exe
mutesysvolume 1"
;Run "c:\winnt\system32\beyondexecv2 \\ICT1-19 c:\winnt\nircmd.exe
mutesysvolume 1"
;Run "c:\winnt\system32\beyondexecv2 \\ICT1-20 c:\winnt\nircmd.exe
mutesysvolume 1"
;Run "c:\winnt\system32\beyondexecv2 \\ICT1-21 c:\winnt\nircmd.exe
mutesysvolume 1"
;Run "c:\winnt\system32\beyondexecv2 \\ICT1-22 c:\winnt\nircmd.exe
mutesysvolume 1"
Run "c:\winnt\system32\beyondexecv2 \\ICT1-23 c:\winnt\nircmd.exe
mutesysvolume 1"
;Run "c:\winnt\system32\beyondexecv2 \\ICT1-24 c:\winnt\nircmd.exe
mutesysvolume 1"
;Run "c:\winnt\system32\beyondexecv2 \\ICT1-25 c:\winnt\nircmd.exe
mutesysvolume 1"
;Run "c:\winnt\system32\beyondexecv2 \\ICT1-26 c:\winnt\nircmd.exe
mutesysvolume 1"
;Run "c:\winnt\system32\beyondexecv2 \\ICT1-27 c:\winnt\nircmd.exe
mutesysvolume 1"
;Run "c:\winnt\system32\beyondexecv2 \\ICT1-28 c:\winnt\nircmd.exe
mutesysvolume 1"
;Run "c:\winnt\system32\beyondexecv2 \\ICT1-29 c:\winnt\nircmd.exe
mutesysvolume 1"
;Run "c:\winnt\system32\beyondexecv2 \\ICT1-30 c:\winnt\nircmd.exe
mutesysvolume 1"
;Run "c:\winnt\system32\beyondexecv2 \\ICT1-31 c:\winnt\nircmd.exe
mutesysvolume 1"
;Run "c:\winnt\system32\beyondexecv2 \\ICT1-32 c:\winnt\nircmd.exe
mutesysvolume 1"

ENDSELECT
EndFunction


Function Button2_Click

$cont = MessageBox("PC sound enabled OK?", "KiXtart", 36)

If $cont = 6
Endif

SELECT
CASE $TextBox.Value = "ICT1"

Run "c:\winnt\system32beyondexecv2 \\serv2k1 c:\winnt\nircmd.exe
mutesysvolume 1"


CASE $TextBox.Value = "ICT2"


Run "c:\winnt\system32beyondexecv2 \\serv2k1 c:\winnt\nircmd.exe
mutesysvolume 1"

CASE $TextBox.Value = "ICT3"

Run "c:\winnt\system32beyondexecv2 \\serv2k1 c:\winnt\nircmd.exe
mutesysvolume 1"


CASE $TextBox.Value = "LIBRARY"

Run "c:\winnt\system32beyondexecv2 \\serv2k1 c:\winnt\nircmd.exe
mutesysvolume 1"

CASE $TextBox.Value = "DT2"

Run "c:\winnt\system32beyondexecv2 \\serv2k1 c:\winnt\nircmd.exe
mutesysvolume 1"

CASE $TextBox.Value = "multi"

Run "c:\winnt\system32beyondexecv2 \\serv2k1 c:\winnt\nircmd.exe
mutesysvolume 1"

CASE $TextBox.Value = "music"


Run "c:\winnt\system32beyondexecv2 \\serv2k1 c:\winnt\nircmd.exe
mutesysvolume 1"



ENDSELECT


EndFunction







EXIT

_________________________
Dont worry because a rival imitates you. As long as they follow in your tracks they cant pass you!

Top
#156695 - 2006-02-06 12:38 PM Re: disabling sound on mass (scripts/forms)
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
what about making a pupil_WKSTA_control_group and giving it rights on each wksta.
then add the teachers you want to have rights to that group.
neater, cleaner and easier to control approach.

now, instead of having all those run lines, consider this:
Code:

$ICT1_machineCount = 32
for $=1 to $ICT1_machineCount
;Run "c:\winnt\system32\beyondexecv2 \\ICT1-"+right("0"+$,2)+" c:\winnt\nircmd.exe mutesysvolume 1"
next

_________________________
!

download KiXnet

Top
#156696 - 2006-02-06 01:02 PM Re: disabling sound on mass (scripts/forms)
Stephen Wintle Offline
Seasoned Scripter

Registered: 2001-04-10
Posts: 444
Loc: England
Hi,

Thanks for that pointer, you know it really is great to have guys like you that don't patronise and are willing to help out!

Are you suggesting that we add a pupil worstation account on each local machine? Give local admin rights. As I am interested in changing pupils domain passwords (or rather the teacher doing this) would this allow us to this?

Many thanks.

Steve

Top
#156697 - 2006-02-06 01:35 PM Re: disabling sound on mass (scripts/forms)
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
Quote:


....
Another problem that I have is that I want my Teachers to be able to change passwords, now I am using the form from kixforms that works fine, only the thing is it works only if your are Domain admins. Is there anyway I can pass Domain admin or user credentials in my script so that the person has elevated
....





If in AD you can delegate this to other users very easily by clicking on the OU/users and choosing delegate control. Then just follow the steps.
Managing Your Organization Unit

Script examples (in VB):
Delegate the Change Password Extended Right for a Single User
Delegate the Change Password Extended Right for an Entire OU
Delegate the Reset Password Extended Right for a Single User
Delegate the Reset Password Extended Right for an Entire OU
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#156698 - 2006-02-06 02:47 PM Re: disabling sound on mass (scripts/forms)
Stephen Wintle Offline
Seasoned Scripter

Registered: 2001-04-10
Posts: 444
Loc: England
Hi thanks again,

Because the format of my machine names are [string]-01...[string]-09 then [string]-10 ... [string]-30 the script does nothing, I tried it from command line and it works fine. Tried the following:
Code:
 
;$LT_machineCount = 9
;for $=1 to $LT_machineCount
;Run "c:\winnt\system32\beyondexecv2 \\LT-"+right("0"+$,2)+" c:\winnt\nircmd.exe mutesysvolume 1"
;next

$LT1_machineCount = 30
for $=10 to $LT1_machineCount
Run "c:\winnt\system32\beyondexecv2 \\LT-"+right($,2)+" c:\winnt\nircmd.exe mutesysvolume 1"
next



Regards

Steve.

Top
#156699 - 2006-02-06 02:47 PM Re: disabling sound on mass (scripts/forms)
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
Quote:

Are you suggesting that we add a pupil worstation account on each local machine? Give local admin rights. As I am interested in changing pupils domain passwords (or rather the teacher doing this) would this allow us to this?





yes but no.
you can add a account but again, you would need to elevate to that account.
what I ment, is make a domain group, or if you want to allow all teachers, you can add the teacher group to each wksta's local admin group.
this way, the account has the rights already.

now, what I originally suggested was that you add a group called something like wksta_admins and add that to each wksta's admin group.
then, add your teacher group to that group.

if you ever at later time want to remove the rights from all teachers, all you need to do is edit that wksta_admins group.
_________________________
!

download KiXnet

Top
#156700 - 2006-02-06 03:03 PM Re: disabling sound on mass (scripts/forms)
Stephen Wintle Offline
Seasoned Scripter

Registered: 2001-04-10
Posts: 444
Loc: England
Hi,

About adding to groups, on each workstation to local groups we have added to administrators group the domain group staff. Now every teacher belongs to the local admins group on each workstation. Should teacher now be able to change passwords in active directory?

Regards.


Steve.
_________________________
Dont worry because a rival imitates you. As long as they follow in your tracks they cant pass you!

Top
#156701 - 2006-02-06 03:06 PM Re: disabling sound on mass (scripts/forms)
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
oh, you want teachers to be able to change AD passwords?
then see the links provided by mart.
_________________________
!

download KiXnet

Top
#156702 - 2006-02-06 04:01 PM Re: disabling sound on mass (scripts/forms)
Stephen Wintle Offline
Seasoned Scripter

Registered: 2001-04-10
Posts: 444
Loc: England
Ok thanks,

But how might I employ the script below and incorporate it into a kix script? Given that I want to give a group (staff) not an invididual user rights to change the passwords for users in OU [curriculum].

regards

Steve.

Code:
 Const ADS_ACETYPE_ACCESS_ALLOWED_OBJECT = &H5
Const ADS_FLAG_OBJECT_TYPE_PRESENT = &H1
Const ADS_FLAG_INHERITED_OBJECT_TYPE_PRESENT = &H2
Const ADS_RIGHT_DS_CONTROL_ACCESS = &H100
Const ADS_ACEFLAG_INHERIT_ACE = &H2

Set objSdUtil = GetObject("LDAP://OU=Finance, DC=fabrikam,DC=Com")
Set objSD = objSdUtil.Get("ntSecurityDescriptor")
Set objDACL = objSD.DiscretionaryACL

Set objAce = CreateObject("AccessControlEntry")

objAce.Trustee = "FABRIKAM\kmyer"
objAce.AceFlags = ADS_ACEFLAG_INHERIT_ACE
objAce.AceType = ADS_ACETYPE_ACCESS_ALLOWED_OBJECT
objAce.Flags = ADS_FLAG_OBJECT_TYPE_PRESENT OR ADS_FLAG_INHERITED_OBJECT_TYPE_PRESENT
objAce.ObjectType = "{ab721a53-1e2f-11d0-9819-00aa0040529b}"
objACE.InheritedObjectType = "{BF967ABA-0DE6-11D0-A285-00AA003049E2}"
objAce.AccessMask = ADS_RIGHT_DS_CONTROL_ACCESS
objDacl.AddAce objAce

objSD.DiscretionaryAcl = objDacl

objSDUtil.Put "ntSecurityDescriptor", Array(objSD)
objSDUtil.SetInfo

_________________________
Dont worry because a rival imitates you. As long as they follow in your tracks they cant pass you!

Top
#156703 - 2006-02-06 04:15 PM Re: disabling sound on mass (scripts/forms)
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
why you want to script it?
it's a one time change for single group thus it's a click click thing, right?
_________________________
!

download KiXnet

Top
#156704 - 2006-02-06 04:19 PM Re: disabling sound on mass (scripts/forms)
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
Scripting it is nice but doing it via the AD users and computers in much nicer. Why re-invent the wheel when MS did this for you. To prevent all kind of sh#t I’d go for the AD U&C for this one.

[edit]
PS: You will need to install (part of) the windows 2000 adminpack on the computers needing to do the password changes.
[/edit]


Edited by Mart (2006-02-06 04:23 PM)
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#156705 - 2006-02-08 10:21 AM Re: disabling sound on mass (scripts/forms)
Stephen Wintle Offline
Seasoned Scripter

Registered: 2001-04-10
Posts: 444
Loc: England
Thanks,

I would be grateful if at all possible is their a way that a user can somehow pass user credentials in a kix script (login and password details)?

Regards

Steve
_________________________
Dont worry because a rival imitates you. As long as they follow in your tracks they cant pass you!

Top
#156706 - 2006-02-08 10:25 AM Re: disabling sound on mass (scripts/forms)
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
Yes it is possible but only with utils like runas.exe. Usernames and pwd's are stored as plain text so everyone can read them and (ab)use these credentials so it's very unsafe and imho should always be avoided.

Code:

C:\Program Files\Support Tools>runas /?
RUNAS USAGE:

RUNAS [ [/noprofile | /profile] [/env] [/netonly] ]
/user: program

RUNAS [ [/noprofile | /profile] [/env] [/netonly] ]
/smartcard [/user:] program

/noprofile specifies that the user's profile should not be loaded.
This causes the application to load more quickly, but
can cause some applications to malfunction.
/profile specifies that the user's profile should be loaded.
This is the default.
/env to use current environment instead of user's.
/netonly use if the credentials specified are for remote
access only.
/savecred to use credentials previously saved by the user.
This option is not available on Windows XP Home Edition
and will be ignored.
/smartcard use if the credentials are to be supplied from a
smartcard.
/user should be in form USER@DOMAIN or DOMAIN\USER
program command line for EXE. See below for examples

Examples:
> runas /noprofile /user:mymachine\administrator cmd
> runas /profile /env /user:mydomain\admin "mmc %windir%\system32\dsa.msc"
> runas /env /user:user@domain.microsoft.com "notepad \"my file.txt\""

NOTE: Enter user's password only when prompted.
NOTE: USER@DOMAIN is not compatible with /netonly.
NOTE: /profile is not compatible with /netonly.

_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#156707 - 2006-02-08 11:16 AM Re: disabling sound on mass (scripts/forms)
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
again, you seem to be looking for a tree in a forest.
I can't, no matter how hard I try, understand why you would want to compromise security using elevation techniques when you have AD in place and everything 2 clicks away.
there are tools and ways, even by microsoft that enable you to accomplish what you want, so why are you looking for a way to tweak it insecurely?
_________________________
!

download KiXnet

Top
Page 1 of 1 1


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

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

Generated in 0.154 seconds in which 0.104 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