Logon Script For Mac
Forums Macs Mac Basics and Help Login Script to check 'prevent computer from sleeping' Discussion in ' Mac Basics and Help ' started by jagooch, Oct 25, 2018. Sep 2, 2017 - Adding Startup Scripts to Launch Daemon on Mac OS X Sierra 10.12.6. Soon as the computer boots up (i.e. Without requiring the user to login).
Hi, i've been looking for a few days now how to create a log in script using batch commands, what im trying to do is create a welcome message map 3 network drives and map a printer which is connected to another computer on the network i have had no problems with mapping the drives however i havent been able to create a welcome message and for mapping a printer i am a little confused as to what i should place for the port section of the line (LPT1,etc) from what i have read vbscript would be easier however i dont have any experience with it. What im trying to do is create a welcome message This can be done through policies. If in a domain, it would be setup on the domain policy.
Windows Logon Script Examples
If a standalone PC (ie: workgroup as vs a domain) then it would be done in the Local Security policy. Look through the Local Security Policy (found in Administrative Tools in the Control Panel). Once you have the LSP open, look in: Local Policies Security Options and look for 'Interactive Logon' and you'll see where you can configure a logon message. Map 3 network drives Simple enough, you would use the net use command. Mailhub for sierra 1.12.8 free download for mac pro.
More info on that in the help files, on microsoft's website, through a google search, or open a command prompt window and type net use /? Map a printer which is connected to another computer on the network You need to install that printer on each computer individually. Click on my name above in my response and read my 'how-to' guide for adding a network printer. The reason I say install it is, once the printer is installed on each client PC/laptop, it doesn't need to be reinstalled each time the computer boots up. Printers are a one time thing.install it and it's there every time you boot up.
From what I can see, you need only create a small batchfile that maps the 3 drives.
I just have a quick question about login triggers and running a script. Our goal is to allow all users to manage print queues.
We currently use MCX and a group added to the lpadmin group. That works.most of the time. Instead - for a more robust solution and one that works off out network - I want to start running a simple script at login that adds the user logging in to the lpadmin group.
The bulk of the script is this: dseditgroup -o edit -n /Local/Default -a $user -t user $group Our JSS is not visible outside of our production network, but for various reasons I can't control, the JSS has a public DNS record. I don't want to cause significant delays when they aren't on the network and it's checking for policies at login. Is there anything that I can do/should be aware of? I think last time I looked at this, there could be a 2 minute delay at times. I think if I just created a policy with 'Make Available Offline' I should be OK correct? Thanks for the advice!
Logon Script For Mapped Drive
Unfrotunately console trick doesn't return the logging in user. That's what I initially tried. Perhaps because the user has not actually logged in completely yet?
I even tried a 'sleep 30' before getting console's owner and sure enough, it just waits 30 seconds before logging in the user with the same bad results for the console owner variable. Fortunately $3 does work and teh script seems to run just fine (IE it adds them to the lpadmin group), so no problems. I'll have to test it on a laptop now. Like I said, I tested this (I added a bunch more logger lines to check each line) and the $3 returned the correct user. I'm sure some people would add some sort of log that the script would check and exit if it has already run for that user, but I ran the script many times on an account and didn't see anything adverse.
After running the script, you can check to see if the user has been added to the group. Dseditgroup -o read -n /Local/Default -t lpadmin Pay attention to the users that follow dsAttrTypeStandard:GroupMembership Hopefully this helps. This list has been very helpful to me! - #!/bin/sh # unlockprinters.sh # # # Created by Aaron Robinson on 5/11/11. # Get variables.
$3 is logging in user. User=$3 group='lpadmin' # Exit if user is root if $user = 'root' ; then logger -i 'No logged in users. Exit 0 fi # Add the logged in user to the lpadmin group. Dseditgroup -o edit -n /Local/Default -a $user -t user $group logger -i '$0: Added user $user to printer group $group' exit 0.