Page 1 of 1 1
Topic Options
#180863 - 2007-09-26 05:00 PM Displaying text in the console
mikeruss Offline
Fresh Scripter

Registered: 2007-09-26
Posts: 7
Hi all

I hope you can help. Done a bit of hunting with no luck ;-(

I have a script which runs for one group only. Depending on the amount of data which needs to be deleted the kix console will stay open for a while. I would like text to appear within the console explaining to the user the delay and normal work can continue. Don't try and close the window blah blah.

FYI: I can get MessageBox to work OK but I dont want that, becasue it's an aditional click for the user etc etc

Any ideas?

My code

IF instr ($grp, "test")
Run '\\itukdc01\NETLOGON\wdsuk\delprof\delprof.exe /I /Q /D:30'
Endif


Top
#180866 - 2007-09-26 05:32 PM Re: Displaying text in the console [Re: mikeruss]
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
Some suggestions
  • Use wkix32.exe
  • SetConsole("Hide")
  •  Code:
    ? "Please wait while deleting user profiles"
    Run '\\itukdc01\NETLOGON\wdsuk\delprof\delprof.exe /I /Q /D:30'
    ; Don't you need admin rights to delete profiles?

Top
#180868 - 2007-09-26 05:44 PM Re: Displaying text in the console [Re: Witto]
mikeruss Offline
Fresh Scripter

Registered: 2007-09-26
Posts: 7
thanks for the quick response.

I've already tried

? "Please wait while deleting user profiles"

with no luck ;-( Any other ideas?

"Don't you need admin rights to delete profiles?"

I will write another script which will use psexec to get around perms issues.



Edited by mikeruss (2007-09-26 05:44 PM)

Top
#180870 - 2007-09-26 06:13 PM Re: Displaying text in the console [Re: mikeruss]
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
I do not get your problem
 Originally Posted By: mikeruss
I've already tried
? "Please wait while deleting user profiles"
with no luck ;-( Any other ideas?

Break On
?
"Please wait while deleting user profiles"
Get $

returns
 Code:
Please wait while deleting user profiles
in a console
To get around a permission issue, you could maybe use a GPO Computer Startup Script?

Top
#180871 - 2007-09-26 06:14 PM Re: Displaying text in the console [Re: mikeruss]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4401
Loc: New Jersey
Try
 Code:
$Msg = "Please continue to work while" + @CRLF + "we clean old user profiles..." + @CRLF
$Msg = $Msg + @CRLF + "This window will self destruct in 5 seconds..."
MESSAGEBOX ($Msg, "Cleaning User Profiles", 64, 5)


This will pop up a dialog box that the user can close, but will close itself after 5 seconds.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#180872 - 2007-09-26 06:17 PM Re: Displaying text in the console [Re: Glenn Barnas]
mikeruss Offline
Fresh Scripter

Registered: 2007-09-26
Posts: 7
Witto - no luck again... could be me being bumb? But... Glenn, that works a treat I'll run with that. See if the users compalin ;-)


Many many thanks all

MIke

Top
#180874 - 2007-09-26 06:20 PM Re: Displaying text in the console [Re: mikeruss]
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
Break On
?
"Please wait while deleting user profiles"
Get $

And you do not get a console window???
I thought you did not want to use MessageBox() ?

Top
#180876 - 2007-09-26 06:21 PM Re: Displaying text in the console [Re: Witto]
mikeruss Offline
Fresh Scripter

Registered: 2007-09-26
Posts: 7
The console always appears, but no txt. The console when using above code stay open and does not close until you hit enter??

Messagebox - Well no but the fact I can auto close...


Edited by mikeruss (2007-09-26 06:23 PM)

Top
#180904 - 2007-09-27 02:12 PM Re: Displaying text in the console [Re: mikeruss]
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Perhaps the console is being created by the "RUN" rather than KiXtart.
Top
#180948 - 2007-09-28 11:42 AM Re: Displaying text in the console [Re: Richard H.]
mikeruss Offline
Fresh Scripter

Registered: 2007-09-26
Posts: 7
Hi again

Ok I am struggling with the fact delprof needs admin rights. psexec is not suitable because it needs a computer list to run against.

Does any one have any ideas?

Top
#180950 - 2007-09-28 11:50 AM Re: Displaying text in the console [Re: mikeruss]
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Why not just set it up as a scheduled job to run periodically, say once a week during a time that the PC is likely to be switched on.

As it is a scheduled job you can configure it to run as the local administrator account, or any other account with a low password change rate.

As a scheduled task you can configure it to run at system startup, which is probably more appropriate than during logon.

Top
#180951 - 2007-09-28 11:54 AM Re: Displaying text in the console [Re: Richard H.]
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Alternatively, run the job from a central location and specify the target server with the "/C" option.
Top
#180952 - 2007-09-28 12:45 PM Re: Displaying text in the console [Re: Richard H.]
mikeruss Offline
Fresh Scripter

Registered: 2007-09-26
Posts: 7
Good idea.... but that means having a file with a password in plain txt on the LAN?

E.g.


SCHTASKS /Create /SC weekly /D MON,TUE,WED,THU,FRI,sat,sun /TN example /ST 09:30:00 /TR "\\script-application.exe /auto" /RU domain\name /RP *******


Edited by mikeruss (2007-09-28 12:47 PM)

Top
#180953 - 2007-09-28 01:03 PM Re: Displaying text in the console [Re: mikeruss]
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
 Quote:
Good idea.... but that means having a file with a password in plain txt on the LAN?


No, not really

Once the scheduled task has been created it is there forever (as long as it is not a one-time-only task).

You only need to create the task (and set the password) once on each machine.

The password that you create the task as is saved with the job in an encrypted form, so it is not exposed.

Your only issue is if the password changes you will need to change it on all the machines, which is why I suggest that you use a local account or a service account whose password expiry is long.

You might want to use "/SC ONSTART" rather than a particular time of day.

Use the "/S systemname" option to schedule the task on a remote computer.

Use the "/U" and "/P" parameters to specify the user to connect as (to create the job) and the "/RU" and "/RP" parameters to specify the user that the job will actually run as.

Top
#180954 - 2007-09-28 01:05 PM Re: Displaying text in the console [Re: mikeruss]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4401
Loc: New Jersey
 Originally Posted By: mikeruss
Good idea.... but that means having a file with a password in plain txt on the LAN?

Don't know why you would think so... The scheduled task runs with the credentials you supply, and doesn't need any additional credentials in the script.

The script that creates the scheduled task only needs to be run once to create the task - it's being done by you, not the end user, and you can supply the password as an argument when you invoke it.

There are ways to obfuscate the password (see CODEC UDF), and tokenizing the setup script would ad a level of security as well. There's also Shawn's Runnas.exe.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#180956 - 2007-09-28 01:32 PM Re: Displaying text in the console [Re: Glenn Barnas]
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
Or
 Originally Posted By: Witto
To get around a permission issue, you could maybe use a GPO Computer Startup Script?

Top
#180959 - 2007-09-28 02:21 PM Re: Displaying text in the console [Re: Witto]
mikeruss Offline
Fresh Scripter

Registered: 2007-09-26
Posts: 7
cheers all - great help and info...
Top
#180967 - 2007-09-28 04:47 PM Re: Displaying text in the console [Re: Richard H.]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4401
Loc: New Jersey
[quote=Richard H.]
 Quote:
Your only issue is if the password changes you will need to change it on all the machines, which is why I suggest that you use a local account or a service account whose password expiry is long.

Just as a point of reference, the tcLib UDF library has functions that make this situation very easy. If you have a list of systems, you can get a list of tasks from each system with one command, use a For/Next to enumerate each task, checking an array value for the presence of a particular user id, and - if found, use the SetCred UDF to change the credentials.

When we ran into this situation at my last job, the guys were crying that changing the sched-task account on 400 servers across 5 sites would take a week of work. With about 30 lines of code - most to enumerate domain computer accounts, filter out the workstations, and then enumerate the individual tasks, I had all tasks that used the task-sched account updated to use the new-task-sched account and password in less than an hour. Not a single task event was impacted!

The SchTask UDF is primarily designed to DEFINE a task event. It's quick, easy, and effective for this. The tcLib package is designed to MANAGE task events. It's simple, once you get the hang of the multiple UDFs, and very effective for analyzing and modifying task events.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

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 566 anonymous users online.
Newest Members
M_Moore, BeeEm, min_seow, Audio, Hoschi
17883 Registered Users

Generated in 0.151 seconds in which 0.083 seconds were spent on a total of 13 queries. Zlib compression enabled.

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