Page 1 of 1 1
Topic Options
#207281 - 2013-05-08 10:25 PM Problems with logon script
MNTechy Offline
Fresh Scripter

Registered: 2009-05-05
Posts: 18
Loc: Minnesota
So I have a logon script that maps all my user drives and put some shortcuts on users desks depending on what location they are at. We use PaperCutPro to monitor print usage, and one of the things they have is a monitor application that can tell the user how much money they still have left in their account. The application is supposed to live on a server share, and you are supposed to be able to run it from the share in your logon script.

So I put the command they recommended in a shell command:

shell "%comspec% \\<server>\pcclient\win\pcclient.exe /silent"

This did not work, the script never finished and the desktop doesn't come up. I've also tried:

shell "%comspec% start \\<server>\pcclient\win\pcclient.exe /silent"
shell "\\<server>\pcclient\win\pcclient.exe /silent"
run "%comspec% \\<server>\pcclient\win\pcclient.exe /silent"
run "%comspec% start \\<server>\pcclient\win\pcclient.exe /silent"
run "\\<server>\pcclient\win\pcclient.exe /silent"

If I turn debugging on in my script, I see the command run, and with some of the above run commands the pcclient window comes up, but when the script finishes and the desktop appears the pcclient is gone.

Does anyone have any thoughts on what I'm doing wrong? Thanks for your help!

Mike

Top
#207285 - 2013-05-08 11:34 PM Re: Problems with logon script [Re: MNTechy]
ShaneEP Moderator Offline
MM club member
*****

Registered: 2002-11-29
Posts: 2127
Loc: Tulsa, OK
Are you sure it's not pc-client.exe as opposed to pcclient.exe?
Top
#207286 - 2013-05-08 11:44 PM Re: Problems with logon script [Re: ShaneEP]
ShaneEP Moderator Offline
MM club member
*****

Registered: 2002-11-29
Posts: 2127
Loc: Tulsa, OK
This should in theory work fine however...

 Code:
Shell '%comspec% /c "\\server\pcclient\win\pcclient.exe /silent"'

Top
#207287 - 2013-05-09 06:01 AM Re: Problems with logon script [Re: ShaneEP]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
lol
_________________________
!

download KiXnet

Top
#207289 - 2013-05-09 02:38 PM Re: Problems with logon script [Re: ShaneEP]
MNTechy Offline
Fresh Scripter

Registered: 2009-05-05
Posts: 18
Loc: Minnesota
Yes, I was wrong, it has the dash... But I had it right in my script... I know it "should" work, but it isn't... Anyone have any thoughts on why it isn't? Again, when I turn on Kix debugging, I can see it start, but as soon as the main script finishes, and the desktop appears, the PC-Client disapears...
Top
#207290 - 2013-05-09 03:30 PM Re: Problems with logon script [Re: MNTechy]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4403
Loc: New Jersey
Did you try Shane's example? None of your Shell statements employ the "%COMSPEC% /C" or the encapsulated quotes.

Two simple rules for Shell:
1. Build a $Cmd string so you can display it in a debug message before calling Shell $Cmd.
 Code:
$Cmd = '%COMSPEC% /c '
$Cmd = $Cmd + '"\\server\pcclient\win\pcclient.exe /silent"'
'About to run ' $Cmd ?
Shell $Cmd
More effort but easy to see problems and manage complex statements.
2. Use single quotes for Kix and double quotes for embedded commands. DOS likes double quotes.

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

Top
#207292 - 2013-05-09 09:08 PM Re: Problems with logon script [Re: Glenn Barnas]
MNTechy Offline
Fresh Scripter

Registered: 2009-05-05
Posts: 18
Loc: Minnesota
I tried building the command like Glenn suggested with the same result. Either way it appears the application starts, it just closes when the desktop appears.

I was wondering if this could have something to do with running the logon script synchronously through Group Policy? But I just changed that from Enabled, to Not Configured, to Disabled and I got the same behavior.

I have to think I'm missing something simple here!

Top
#207293 - 2013-05-09 09:15 PM Re: Problems with logon script [Re: MNTechy]
MNTechy Offline
Fresh Scripter

Registered: 2009-05-05
Posts: 18
Loc: Minnesota
I also just ran the logon script after I was logged in (\\\netlogon\iplogon.bat) and the script runs, I see my debug window come up and the PCClient starts. However the Debug window stays up on the screen too, even after the main script finishes? Maybe that's normal behavior for the debug window? I can close it by clicking on the X in the corner.

My PCClient stays running if I run the script after logon, which leads me to believe it is running the logon script in a different context than the logged in user since it goes away if run during logon?

Top
#207294 - 2013-05-09 10:20 PM Re: Problems with logon script [Re: MNTechy]
MNTechy Offline
Fresh Scripter

Registered: 2009-05-05
Posts: 18
Loc: Minnesota
So, it was the synchronous setting in Group Policy, it just took a reboot, not a logoff to take effect. So it's working now. I thought it used to be recommended to have synchronous on back in the day, but maybe that's changed... All seems to be working anyway...

Thanks!
Mike

Top
#207295 - 2013-05-09 10:44 PM Re: Problems with logon script [Re: MNTechy]
ShaneEP Moderator Offline
MM club member
*****

Registered: 2002-11-29
Posts: 2127
Loc: Tulsa, OK
No problem. Glad it works now.

If you do happen to launch it using the %comspec% as in the above examples, don't forget that /C switch. Just didn't see it in the examples you originally posted, and that could cause the command window to possibly stay open after it runs.

Top
#207296 - 2013-05-09 10:50 PM Re: Problems with logon script [Re: ShaneEP]
MNTechy Offline
Fresh Scripter

Registered: 2009-05-05
Posts: 18
Loc: Minnesota
What I actually have that's now working is this:

RUN '\\print02\PCClient\win\pc-client.exe /silent'

The %comspec% worked but popped an error about trying to run a UNC path from a command line... No error this way.

But thanks for the reminder on the /c... I have to be more thorough when I post my examples and not just go from memory! Obviously that isn't working any more! LOL!

Mike

Top
#207297 - 2013-05-10 12:05 AM Re: Problems with logon script [Re: MNTechy]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4403
Loc: New Jersey
Mike,

Sync operation is recommended to insure all resources/procedures are performed before allowing the user access. I generally avoid policy based logon scripts because of the context they run in. I use login scripts to establish the user environment.

In recent tests at a fairly large site, the profile based login script processing the same group-based authoriztion logic ran in 4.45 seconds compared to the policy taking nearly 17 seconds to complete.

Also - policy changes won't take effect on logoff/logon unless you run a GPUPDATE /FORCE before logging off. Policies run at boot and roughly every 90 minutes thereafter unless manually applied.

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
1 registered (Henriques) and 2516 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

Generated in 0.063 seconds in which 0.026 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