#206139 - 2012-11-07 10:53 PM
all new 2 me, much to learn but need help now pls
|
Scriptless_1
Fresh Scripter
Registered: 2012-11-06
Posts: 5
Loc: Oklahoma City, OK, 73159
|
Inherited the existing working login script below from previous admin, may or may not look good, but it works. Making it look better will have to come when I’ve learned much more. It’s all got to sound lame but my situation is as follows, pls forgive the ignorance, much to learn.
I need to add the commands to successfully run a printer migration utility called Printmig330a.exe using the /all switch.
Printmig330a.exe resides in the subfolder named PRINTMIG off the root of a drive mapped as I: Within the same PPRINTMIG folder is a batch file that is currently being used to call Printmig330a.exe after it completes the series of instruction listed here. md c:\logfile copy I:\PrintMig\*.* c:\logfile cd c:\logfile dir>c:\logfile\mig1.log dir>c:\logfile\mig.log Printmig330a.exe /all
Additionally I have created an Active Directory Distribution Object named PrintMig that I will drop groups of users into to control the volume of users and data traffic at login.
I think I understand that the series of instructions called from the batch file routine can be done within the script itself without calling or using the batch file. I have tried to make this work both ways and am simply missing IT. I need to integrate it into the existing script below, If anyone can help please let me know.
BELOW FROM HERE IS THE EXISTING LOGINSCRIPT
**** Last Modified on 10/7/2009 at 2:40:42 PM ****
?
?("*******************************************************************************");
?(" Logon Domain: ") (%USERDOMAIN%);
?(" Logon Server: ") (%LOGONSERVER%);
?(" Username: ")(%USERNAME%);
?(" Workstation: ")(%COMPUTERNAME%);
?("*******************************************************************************");
?
?
?
?("Now Mapping User H Drive")
Use H: /delete /persistent
Use H: "\\okcpfs01vh\home\%USERNAME%"
?("The Command Completed Successfully")
?
?("Now Mapping Departmental Drives")
?
;Section that Maps Network Drives By Departmental Group
use I: /delete /persistent
use I: "\\okcpfs01vh\shared"
?("The Command Completed Successfully")
gosub "general"
:General
?
?("Now Mapping R Drive")
Use R: /delete /persistent
Use R: "\\xprthq1\whmail"
?("The Command Completed Successfully")
?
?("Now Mapping S Drive")
Use S: /delete /persistent
Use S: "\\xprthq1\ehmail"
?("The Command Completed Successfully")
?
?("Now Mapping Forms T Drive")
Use T: /delete /persistent
Use T: "\\xprthq1\forms"
?("The Command Completed Successfully")
If Exist ("%LOGONSERVER%\netlogon\okc1\%USERNAME%.kix")?Call "%LOGONSERVER%\netlogon\okc1\%USERNAME%.kix"
?
Else EndIf
?
Edited by ShaneEP (2012-11-08 12:25 AM) Edit Reason: added code tags
|
|
Top
|
|
|
|
#206140 - 2012-11-08 12:24 AM
Re: all new 2 me, much to learn but need help now pls
[Re: Scriptless_1]
|
ShaneEP
MM club member
   
Registered: 2002-11-29
Posts: 2127
Loc: Tulsa, OK
|
This should get you started.
$logdir = "C:\logfile"
If Not Exist("C:\logfile\*.*")
MD "C:\logfile"
Endif
Copy "I:\PrintMig\*.*" "C:\logfile\*.*"
Shell "C:\logfile\Printmig330a.exe /all" Please try to use the code button when you post scripts in the future as it maintains the format better.
|
|
Top
|
|
|
|
#206146 - 2012-11-08 12:58 AM
Re: all new 2 me, much to learn but need help now pls
[Re: ShaneEP]
|
NTDOC
Administrator
   
Registered: 2000-07-28
Posts: 11629
Loc: CA
|
If Not @LogonMode
Break On
EndIf
Dim $SO
$SO=SetOption('Explicit','On')
$SO=SetOption('NoVarsInStrings','On')
$SO=SetOption('NoMacrosInStrings','On')
$SO=SetOption('WrapAtEOL','On')
Dim $Folder
$Folder='C:\logfile\'
;Check if the folder exists, if not create it otherwise continue on.
If GetFileAttr($Folder) & 16
;Folder found do nothing
Else
MD $Folder
If @ERROR
Quit @ERROR
EndIf
EndIf
|
|
Top
|
|
|
|
#206154 - 2012-11-08 03:01 PM
Re: all new 2 me, much to learn but need help now pls
[Re: ShaneEP]
|
Scriptless_1
Fresh Scripter
Registered: 2012-11-06
Posts: 5
Loc: Oklahoma City, OK, 73159
|
Shane, Thank You for you help and advice on how to you the site and your patience with new users. Huge learning curve, Ive listed below my understanding of what you offered but need your help to clear things up.
$logdir = "C:\logfile" this line defines the object C:\logfile If Not Exist("C:\logfile\*.*" this variable to check if it aleady exists MD "C:\logfile" this command to create if it does not Endif this ends this section of code
Copy "I:\PrintMig\*.*" "C:\logfile\*.*" this copies source files to c:\logfile
Shell "C:\logfile\Printmig330a.exe /all this obviously runs the utillity
What is missing is code that will check to see if the user logging in is a member of the Active Directoy distribution object called PrintMig and if so then run the commands you have already assisted me with. And then where in the original code to insert all of it. I think just below the end of the T Drive Map statement but before the findal If Exist statement? If you could help me with these last two matters it would be greatly appreciated. I have so much to learn but this is killing me right now. Thank you
|
|
Top
|
|
|
|
#206160 - 2012-11-08 04:52 PM
Re: all new 2 me, much to learn but need help now pls
[Re: Scriptless_1]
|
ShaneEP
MM club member
   
Registered: 2002-11-29
Posts: 2127
Loc: Tulsa, OK
|
Is PringMig a group? If so this should work.
If InGroup("PrintMig")
If Not Exist("C:\logfile\*.*")
MD "C:\logfile"
Endif
Copy "I:\PrintMig\*.*" "C:\logfile\*.*"
Shell "C:\logfile\Printmig330a.exe /all"
Endif As for the placement, it's totally up to you. As long as it's after that I: mapping. After that final T mapping would be fine.
|
|
Top
|
|
|
|
#206162 - 2012-11-08 08:16 PM
Re: all new 2 me, much to learn but need help now pls
[Re: Les]
|
Scriptless_1
Fresh Scripter
Registered: 2012-11-06
Posts: 5
Loc: Oklahoma City, OK, 73159
|
hmm, yea, PrinMig is currently a distribution group, will change that and see, thanks for the input
|
|
Top
|
|
|
|
#206163 - 2012-11-08 10:01 PM
Re: all new 2 me, much to learn but need help now pls
[Re: Scriptless_1]
|
Scriptless_1
Fresh Scripter
Registered: 2012-11-06
Posts: 5
Loc: Oklahoma City, OK, 73159
|
CODE BUTTON?
|
|
Top
|
|
|
|
#206164 - 2012-11-08 11:05 PM
Re: all new 2 me, much to learn but need help now pls
[Re: Scriptless_1]
|
Scriptless_1
Fresh Scripter
Registered: 2012-11-06
Posts: 5
Loc: Oklahoma City, OK, 73159
|
Almost HOME, Thanks DOC, Shane and Les. I am able to successfully run the utility using the script. . . (at last finally submitted here in code, yea!)Thank you again for your patience and assistance.
Like I said, the utility finally runs, but it has global effect, I am not yet able to get the If InGroup ("PrintMig") to work. I enter the command and it will wants something . . . a command such as Run etc, either immediately after the commnet or when i select enter, at shfit-return the next line indents and prompts for something.
HELP NEEDED HERE PLEASE> > > At lines 35-37, Between the If InGroup ("PrintMig")and the If Not @LogonMode command something must go there to make the transition, I duno? Additionally, I have replaced the previous PrintMig Distribution Directory Object with a Security Group-Domain Local object of the same name and have added test members. . . . no luck
?
?("*******************************************************************************");
?(" Logon Domain: ") (%USERDOMAIN%);
?(" Logon Server: ") (%LOGONSERVER%);
?(" Username: ")(%USERNAME%);
?(" Workstation: ")(%COMPUTERNAME%);
?("*******************************************************************************");
?
?
?
?("Now Mapping User H Drive")
Use H: /delete /persistent
Use H: "\\servername\sharename\%USERNAME%"
?("The Command Completed Successfully")
?
?("Now Mapping R Drive")
Use R: /delete /persistent
Use R: "\\servername\sharename"
?("The Command Completed Successfully")
?
?("Now Mapping S Drive")
Use S: /delete /persistent
Use S: "\\servername\sharename"
?("The Command Completed Successfully")
?
?("Now Mapping Forms T Drive")
Use T: /delete /persistent
Use T: "\\servername\sharename"
?("The Command Completed Successfully")
?
use I: /delete /persistent
Use I: "\\servername\sharename"
?("The Command Completed Successfully")
?
If InGroup "PringMig" it wants something here or
here ******************** THIS IS WHERE IS HURLS ***********************
If Not @LogonMode
Break On
EndIf
Dim $SO
$SO=SetOption('Explicit','On')
$SO=SetOption('NoVarsInStrings','On')
$SO=SetOption('NoMacrosInStrings','On')
$SO=SetOption('WrapAtEOL','On')
?
?
Dim $Folder
$Folder='C:\logfile\'
;Check if the folder exists, if not create it otherwise continue on.
If GetFileAttr($Folder) & 16
;Folder found do nothing
Else
MD $Folder
If @ERROR
Quit @ERROR
EndIf
EndIf
?
Copy "I:\Printmig\*.*" "C:\logfile\*.*"
Shell "C:\logfile\printmig330a.exe /all
|
|
Top
|
|
|
|
#206168 - 2012-11-09 02:41 AM
Re: all new 2 me, much to learn but need help now pls
[Re: ShaneEP]
|
ShaneEP
MM club member
   
Registered: 2002-11-29
Posts: 2127
Loc: Tulsa, OK
|
?
?("*******************************************************************************");
?(" Logon Domain: ") (%USERDOMAIN%);
?(" Logon Server: ") (%LOGONSERVER%);
?(" Username: ")(%USERNAME%);
?(" Workstation: ")(%COMPUTERNAME%);
?("*******************************************************************************");
?
?
?
?("Now Mapping User H Drive")
Use H: /delete /persistent
Use H: "\\servername\sharename\%USERNAME%"
?("The Command Completed Successfully")
?
?("Now Mapping R Drive")
Use R: /delete /persistent
Use R: "\\servername\sharename"
?("The Command Completed Successfully")
?
?("Now Mapping S Drive")
Use S: /delete /persistent
Use S: "\\servername\sharename"
?("The Command Completed Successfully")
?
?("Now Mapping Forms T Drive")
Use T: /delete /persistent
Use T: "\\servername\sharename"
?("The Command Completed Successfully")
?
use I: /delete /persistent
Use I: "\\servername\sharename"
?("The Command Completed Successfully")
?
?
?
If InGroup("PrintMig")
If Not @LogonMode
Break On
EndIf
;Check if the folder exists, if not create it otherwise continue on.
If Exist("C:\logfile\*.*")
;Folder found do nothing
Else
MD $Folder
If @ERROR
Quit @ERROR
EndIf
EndIf
Copy "I:\Printmig\*.*" "C:\logfile\*.*"
Shell "C:\logfile\printmig330a.exe /all"
Endif
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 394 anonymous users online.
|
|
|