ADMaster Posted August 18, 2017 Posted August 18, 2017 I'm not sure where to put this, I'm just putting out ideas trying to figure out the best method. I have lanschool it operates on channels. Each classroom / teacher combination is on their own channel. I can specify the channel during install on the command line, log into the console and set channel afterwords, or use a program called set channel and pass the channel on the command line. At one point I deployed it via SCCM as part of OSD and just set the channel later. Now I use pdq and adjust the command line parameters each time, or if I forget I then push setchannel with the correction. When I need to reimage a PC I'll often get a call a few days later that it needs lanschool. I'd like to make it part of OSD but either prompt for, or get the channel from a preset property / variable. The only idea I have atm is create multiple copies of the application each with the correct command line arguments. Then deploy to the correct computers via collections. This would get picked up after OSD which is fine. Any ideas / suggestions or am I asking too much.
chris_uk Posted August 18, 2017 Posted August 18, 2017 Why not set it via Group Policy? Roll out the MSI to all workstations and they will pick it up the GPO. 1
ADMaster Posted August 18, 2017 Author Posted August 18, 2017 Probably because it's late on a Friday, sounds like a good excuse yeah. I forgot about them having a GPO option, at one point the admx files were bugged and I had to edit them myself. Also that would be several GPOs with just one setting. It has me thinking though I wonder if I could set the same thing via GPP registry and use item level targeting.
chris_uk Posted August 18, 2017 Posted August 18, 2017 Nause to setup in the first place, but once it is setup you pretty much forget about it. We have one per room main ICT Teaching room, so 14 different channels. Yes 14 different Group Policies, but it now just works.
dapaulio Posted August 18, 2017 Posted August 18, 2017 (edited) Why not create a batch file which looks for environment variables and link it to a startup script. Quickly whipped this script up based on my computers naming convention eg Room-PCNum eg s11-01, s9-02 etc etc Install.cmd @echo off #Finds the computers name for /f "tokens=*" %%f in ('wmic computersystem get name /value ^| find "="') do set "%%f" #Truncates the name before the - to get the room name set "name=%Name:-="&rem % #Sets a case based on the result which will assign it a channel 2>NUL CALL :CASE_%NAME% IF Errorlevel 1 Call :DEFAULT_CASE Exit /B :CASE_IT1 Set CHANNEL=1 GOTO Install :CASE_IT2 Set CHANNEL=2 GOTO Install :CASE_IT3 Set CHANNEL=3 GOTO Install :DEFAULT_CASE ECHO Room not in the list GOTO END_CASE :Install #Installs based on the parameter obtained above Echo Parameters Collated installing room %NAME% on Channel %CHANNEL% #runs the command line script inputting the Channel as the variable obtained echo Msiexec.exe /i "\teacher.msi" /qn ADVANCED_OPTIONS=1 SECURE_MODE=1 PASSWORD=test PASSWORD_CONFIRM=test CHANNEL=%CHANNEL% ENABLECHANNELSELECT=0 LCS=192.168.2.3 RELAY=10.1.1.2 :END_CASE #Cleans up VER > NUL GOTO :EOF [/Code] One group policy assigned to many OU's Hope this helps Edited August 18, 2017 by dapaulio 1
dapaulio Posted August 18, 2017 Posted August 18, 2017 tell a lie you may need 2 gpo to differentiate between student and teacher installers. but with minor adjustments you can make a script for teachers and one for students. if you are really feeling brave you could try modifying the script to determine whether it is a teacher or student pc.
Arthur Posted August 19, 2017 Posted August 19, 2017 (edited) I am surprised at the suggestions to use Group Policy for deployment when you already have SCCM. You're slowing down the boot speeds and missing out on a lot of useful features without good reason. It's like going back to the Dark Ages! 😱 😮 Any ideas / suggestions How are your PCs organised in AD? If you have each classroom in its own OU a much simpler solution would be to create a single application in SCCM with multiple deployment types (one for each channel). The channel would be specified as a property on the msiexec install command line and on the requirements tab you would set the OU the PC has to be in. You can then deploy the SCCM application to a collection containing all of the classroom PCs that need LanSchool installed. SCCM will check the requirements and automatically set the relevant channel. If on the other hand you need to deploy LanSchool based on the computername of the classroom PC name (or some other criteria) I would either use a global condition to determine which channel to use based on the output of a script/WQL query or (better still) don't bother with GCs at all and use the PowerShell App Deployment Toolkit (PSADT) to manage both the application installation and channel selection while still using the SCCM application model for deployment. I have attached an example PSADT script. You could modify this to suit you needs, copy the student and teacher MSIs into the Files subfolder, create an SCCM application with the install/uninstall commands pictured below and set the detection methods to be the product codes of the MSIs (with an OR condition). With this method you can do what @dapaulio suggested in post #5 but without any of the downsides of Group Policy or startup script deployment. It's also easy to maintain since all of the logic is in the script. If you need to add another classroom, amend Deploy-Application.ps1, right-click the Deployment Type and select "Update Content", then deploy to a new collection or redeploy to an existing updated collection. When it comes time to deploy a newer version of LanSchool you can use SCCMs supersedence rules to easily uninstall the old version and install the updated version. LanSchool PSADT Script.zip Edited August 19, 2017 by Arthur 1
dapaulio Posted August 19, 2017 Posted August 19, 2017 Sccm or gpo you can deploy either way . The mechanism of how you deploy it doesn't matter and wasn't the question. I'll admit I've never used sccm and have very little experience or knowledge but from what I read about it and maybe wrong in saying but You cannot call a script on shutdown in sccm where gpo you can. Regardless of the fact The question was how to automate an installation with variable switches in the easiest and simplest possible way. GUIs will come and go meaning you will always have to find a solution to a problem you have already done. Not saying sccm is bad but I have not found an incentive or the time to implement and use it myself, which is why I probably can't appreciate it. Why fix something that isn't broken. Scripting is timeless and efficient when written properly and don't cause any disruption on my network. It Maybe old School techniques but cmd and ps scripting will always remain. Also you don't have to put it in startup. I agree you shouldn't make startup and login any slower then it necessarily has too. Alternatively I would prefer call scripts on shutdown. A time when the end user is not likely to be waiting around. That is my opinion but on the back of this as it is school hols sometime over the next few weeks I may implement sccm and see what the hype is about.
ADMaster Posted August 22, 2017 Author Posted August 22, 2017 Thanks for the ideas all. I'm going to start out with the SCCM deployment types method. However I think I'd like to go down the powershell script route when I have more time to write and test. Simply because it would be one place to update the msi details instead of every deployment type I will have. Unless there is a quick way of doing that. Thanks,
ADMaster Posted August 25, 2017 Author Posted August 25, 2017 (edited) I have made progress on my own scripts for this. They worked to a few test machines in PDQ so I'll move them to SCCM next. I have two naming schemes; student machines are building prefix RM room number computer number. Teachers are building prefix username year of laptop issue ES-RM100-01 ES-jblogs-17 I used the switch statement with wildcard for the student install. If my logic works out the way i expect. If a room is identified with a channel it will get the channel, otherwise it will get a default channel for that building. If it doesn't match any then lanschool does not get installed. Teachers were different because they are based off their name. I created a spreadsheet in sheets with two columns. Name and Chan. I then download it as CSV. I loop through the CSV and assign the channel to the computer name if found. If the channel is blank, or the computer is not found lanschool is not installed. I have two main TS's in SCCM Teacher and Student. I think I can add the appropriate application to the TS and it will install to only the computers that should have it. If I reimage an admin PC with the Teacher TS they will not get lanschool because they are not in the file. I can see getting bit by this in a years time or so when we get new staff and I forget to update the csv, but other then that this seams to be the best method. Attached are my scripts, of course the LCSIP and room numbers have been changed. Thanks,lanschool.zip Edited August 25, 2017 by ADMaster
Arthur Posted August 25, 2017 Posted August 25, 2017 (edited) I can see getting bit by this in a years time or so when we get new staff and I forget to update the csv, but other then that this seams to be the best method. Just an idea, but what about getting the channel number from an AD attribute (like the Description field on the teachers computer) e.g. function InstallTeacher { reg add "HKEY_LOCAL_MACHINE\Software\Wow6432Node\LanSchool" /v IgnoreRegPrompt /d 1 /t REG_DWORD /f reg add "HKEY_LOCAL_MACHINE\Software\LanSchool" /v IgnoreRegPrompt /d 1 /t REG_DWORD /f start -Wait msiexec -ArgumentList " /i teacher.msi /qn ADVANCED_OPTIONS=1 AD_SECURE_MODE=1 LCS=192.168.1.1 CHANNEL=$channel" } $channel = $null $channel = (New-Object DirectoryServices.DirectorySearcher -Property @{ Filter = "(&(objectcategory=computer)(name=$env:computername))" SearchRoot = 'LDAP://OU=Computers,DC=example,DC=net' SearchScope = 'SubTree' PageSize = 2000 }).FindAll() | ForEach-Object { $_.Properties.description } | Select -First 1 if (-not ([string]::IsNullOrEmpty($channel))) { InstallTeacher } Every time you add a teacher PC to SCCM, just update the relevant AD attribute with the channel number. If the attribute is blank LanSchool doesn't get installed either. Edited August 25, 2017 by Arthur
ADMaster Posted August 25, 2017 Author Posted August 25, 2017 I thought of querying AD but of course used the get-adcomputer cmdlet which would not be available on all workstations. I was thinking of using it to set channel by OU for student computers. I will test this method to see if the script will have permission to search AD from the client workstation. Thanks,
ADMaster Posted August 25, 2017 Author Posted August 25, 2017 I've just noticed a problem with this setup. If I push this out via pdq the script will just report success weather the app is installed or not. Because it reports the exit code of the script. However I've just added it to my TS and I specified product code and version in the success conditions. If I run this on an admin PC that is not in my csv or later have the AD attribute set, the script will succeed but fail the TS. I see I can use a script to determine success. Does it have access to the application files. Can I import the csv and use the same logic? Or perhaps the simplest would be to put it in an install step of its own and continue on error? Thanks,
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now