Page 1 of 1 1
Topic Options
#160537 - 2006-04-07 09:14 PM echo y | error
alexchevrier Offline
Fresh Scripter

Registered: 2002-11-11
Posts: 15
Loc: Quebec
I'm trying to create a script to change the security automatically on our Windows 2000 and XP, but I can't get the echo y | to work. For my case it's "o |" because we use french Windows.


If @ProductType = 'Windows 2000 Professional'
$Windows = 'C:\Winnt'
Else
$Windows = 'C:\Windows'
Endif

? 'Windows = $Windows'
? ''

CD "C:\"
Shell 'echo o|cacls "C:" /T /C /G "Administrateurs":F "System":F "Utilisateurs avec pouvoir":C "Utilisateurs":R'
Shell 'echo o|cacls "C:\Documents and Settings" /T /E /C /G "createur proprietaire":C'

If Exist ($Windows + '\progkill.exe')
? 'Sécurité pour ProgKill'
? ''
Shell 'cacls $Windows\progkill.sys /E /G "Utilisateurs":C'
Shell 'cacls $Windows\progkill.dll /E /G "Utilisateurs":C'
EndIf

If Exist ('C:\Program Files\Cogigraphe')
? 'Sécurité pour Cogigraphe'
? ''
Shell 'echo o|cacls $Windows /T /C /G "Utilisateurs":C'
Shell 'echo o|cacls $Windows\*.* /T /C /P "Utilisateurs":R'
EndIf

If Exist ('C:\Program Files\Tacmi')
? 'Sécurité pour Pixia'
? ''
CD 'C:\Program Files\Tacmi'
Shell 'cacls Pixia /e /p "Utilisateurs":C'
CD 'C:\'
EndIf

If Exist ('C:\program Files\ttw\ttw.dus')
? 'Sécurité pour Tap'Touche Windows'
? ''
Shell 'cacls "C:\program Files\ttw\ttw.dus" /E /G "Utilisateurs":C'
EndIf

If Exist ('C:\Program Files\Hewlett-Packard\HP PrecisionScan\ISTech\PLUGINS11')
? 'Sécurité pour Scanners HP'
? ''
CD 'C:\Program Files\Hewlett-Packard\HP PrecisionScan\ISTech\PLUGINS11'
Shell 'cacls *.* /E /G "utilisateurs":C'
CD 'C:\'
EndIf

Top
#160538 - 2006-04-07 09:30 PM Re: echo y | error
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
Shell 'cmd /c echo o|cacls ...

some even have a direct /y switch

when you are piping/redirecting you usually need "cmd /c" or "%comspec% /c" or whatever
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#160539 - 2006-04-08 02:58 AM Re: echo y | error
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
%COMSPEC% /c would be best practice since it uses an environment variable.
Top
#160540 - 2006-04-08 04:37 PM Re: echo y | error
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
That is bizar...
I used cacls for te first time in a script with /T /E /C and /P (not /G)
It never asked me for a "y"es or "o"ui
While testing, without /T /E or /C, both /P and /G did ask for "y"es.
When adding /E (Edit the ACL, not replace the ACL) it does not ask for confirmation.
Is this for use during logon? I don't think a normal user can change ACL on the %WinDir% or %ProgramFiles%.

Top
#160541 - 2006-04-09 02:03 PM Re: echo y | error
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
They can, if they have local admin rights. Then again, it's not a best practice to either change the ACLs on those directories, unless you tighten them up, or to give your users local admin rights.
_________________________
There are two types of vessels, submarines and targets.

Top
#160542 - 2006-04-10 02:59 PM Re: echo y | error
alexchevrier Offline
Fresh Scripter

Registered: 2002-11-11
Posts: 15
Loc: Quebec
Thanks for the help, I modified my script for Shell "%comspec% /c echo o|cacls..." and it worked. The script is not a logon script. It's a technician script to lock the computers for our students in our computer labs. Since we must run programs that are old, some of them need more access, like writing a temp file in the windows folder.
Top
#160543 - 2006-04-10 10:07 PM Re: echo y | error
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
Still, I think you do not need "echo o|" when using "/E"
Top
#160544 - 2006-04-18 06:01 PM Re: echo y | error
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
You may have better results using -
WshPipe() - Pipes the results of a shell command to an array.

HTH,

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

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 847 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

Generated in 0.054 seconds in which 0.024 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