Simple scripting qustion
Hello. I'm working as part of the SCCM team. Currently I've got two programs I can't deploy using bits for reasons we can't grasp (or log). So I'm doing something else.
To that end, a question:
If I call a batch script from within another batch script, will %~dp0 become the path to the called batch or the original one ?
To that end, a question:
If I call a batch script from within another batch script, will %~dp0 become the path to the called batch or the original one ?
if its a batch script
at the end of the code and you will need to press enter to continue. in other words it will show you what happened in the script
(used this myself when i make backups, ive created a batch script to backup files on backup hdd using it, adding the "pause" command allows me to see if there have been any errors)
ye I know those basic things - but pause isn't very useful to me, as what I'm testing is run as the SYSTEM user, and not mine. I can fake myself into session 0 to see what's going on, but I rather don't want to bother. And running stuff that isn't the right script isn't always an indicator of what's going on.
Anyhow, the guy above was right as to how it works. My scripts still failed, as I forgot to enclose the command that creates the start menu links, but that's solved now and should work. If not I'll just make an msi file instead. That always works with bits.
Here's the final, for now, script to 'install' one piece of stupid software.
REM KEFR@ITCSYD.DK 30-01-2012
REM Pilz Pnoz MultiConfigurator 8.1.0
REM Changed to run from autodesk share 03-02-2012
type nul>"%windir%"\test-file.kefr 2>nul && (del "%windir%"\test-file.kefr & set uac=0) || (set uac=1)
if not %uac%==0 goto err
if not exist "%~dp0xxmklink.exe" goto err
xcopy /i/h/c/e/y "%~dp0pilz" "c:\pilz" >nul
if defined ProgramData xcopy /i/h/c/e/y "%~dp0ProgramData\pilz" "c:\ProgramData\pilz"
if defined ProgramW6432 start /WAIT "" regedit /s "c:\pilz\x64.reg"
if not defined ProgramW6432 start /WAIT "" regedit /s "c:\pilz\x86.reg"
if defined ProgramData "%~dp0xxmklink.exe" "c:\users\public\DESKTOP\Pnoz MultiConfigurator 8.1.0" "C:\Pilz\PNOZmulti 8.1.0\PNOZmulti v810.exe" "" "C:\Pilz\PNOZmulti 8.1.0" "Start Pnoz MultiConfigurator 8.1.0"
if not defined ProgramData "%~dp0xxmklink.exe" "c:\documents and settings\all users\skrivebord\Pnoz MultiConfigurator 8.1.0" "C:\Pilz\PNOZmulti 8.1.0\PNOZmulti v810.exe" "" "C:\Pilz\PNOZmulti 8.1.0" "Start Pnoz MultiConfigurator 8.1.0"
if not defined ProgramFiles(x86) start /WAIT "" "C:\Pilz\PNOZmulti 8.1.0\PNOZmulti_USB_Interface_Driver\dpinst32.exe" /S /PATH "C:\Pilz\PNOZmulti 8.1.0\PNOZmulti_USB_Interface_Driver"
if defined ProgramFiles(x86) start /WAIT "" "C:\Pilz\PNOZmulti 8.1.0\PNOZmulti_USB_Interface_Driver\dpinst64.exe" /S /PATH "C:\Pilz\PNOZmulti 8.1.0\PNOZmulti_USB_Interface_Driver"
start /WAIT "" cacls "C:\Pilz\PNOZmulti 8.1.0\*.*" /E /T /G "Alle":C
start /WAIT "" cacls "C:\ProgramData\Pilz\PNOZmulti v8.1.0\*.*" /E /T /G "Alle":C
if %uac%==0 (echo Error! Files needed not found. Aborting!) ELSE (echo Error! UAC interfering! Aborting!)
dir c:\vollapyk-for-at-faa-sccm-til-at-melde-fejl >nul 2>&1
What issues are you having when trying to install the application itself?
Hit me up on here or catch me over at MyItForums.com - the SCCM specialist website.
I've never not been able to install software through SCCM in any condition. I've installed hundreds of applications varying from POTS to homegrown POS apps.
You're using XenCenter.. if you're using XenDesktop with a gold image, SCCM won't work because the GUID within the gold image is replicated out to all of your existing XenDesktops.. you'll have to delete the SMSCLI file (C:\windows) and have it recreate by restarting the SMS service.
Also, if you're installing on a TS, you'll have to disconnect all remote users, change the installed type (change user install/execute), install software, change user type back, and you should be good to go.
If you're trying to install a piece of software that registers in the HKCU, you can only do that when the user account islogged in and it will need to run for each user. By default the SCCM service account runs as the local System account which doesn't have HKCU access.
And last.. for testing purposes if you have PSTools available, you can run "Psexec -i -s cmd" to run a command prompt in inactive, system mode, to test your installation script outside of SCCM, but the same as wat SCCM would install as.
I can't use the normal installers as they're 16bit. So I just xcopy the files and make lnk files. I got it working by copying the files from a network share instead of having bits copying it into the ccm cache folder.
For some reason bits seems to fail with select files despite us having removed everything from the restricted files section of the iis config. Not sure where to find a log file detailing why it happends.
But in future I'll just pack these stupid programs as msi.
Can you suggest some software or procedure that can explain what happends on clients with regard to deployments? The ccm logs aren't too userfriendly.
Also how would you deploy software like autodesk products that run off of a network share?
Ps xencenter is just for our test computers because the pxe image doesn't find the vmware harddrive.
riser said:If you're trying to install a piece of software that registers in the HKCU, you can only do that when the user account islogged in and it will need to run for each user. By default the SCCM service account runs as the local System account which doesn't have HKCU access.
I forgot to respond to this part. I've sort of solved that issue noob style. Following is from one piece of badly written software I had to package late last year:
start /WAIT "" reg load "hku\DefUsr" "c:\users\default\ntuser.dat"
start /WAIT "" reg copy "hkcu\Software\VB and VBA Program Settings\MalerOpm" "hku\DefUsr\Software\VB and VBA Program Settings\MalerOpm" /s /f
start /WAIT "" reg copy "hkcu\Software\VB and VBA Program Settings\VisAdm" "hku\DefUsr\Software\VB and VBA Program Settings\VisAdm" /s /f
start /WAIT "" reg export "hkcu\Software\VB and VBA Program Settings\MalerOpm" "%public%\documents\malerkalk1.reg" /y
start /WAIT "" reg export "hkcu\Software\VB and VBA Program Settings\VisAdm" "%public%\documents\malerkalk2.reg" /y
start /WAIT "" reg unload "hku\DefUsr"
Basically copies over the settings from HKCU to the default user profile of Windows 7, and makes two reg files that users with existing profiles can doubleclick on if they need the software.
When viewing the log files, make sure you're using the included Trace32.exe application. It really makes the logs a lot easier to read and understand. It can be found on the SCCM primary server. I'd honestly deploy that out in your base image or send it out to all computers since it is licensed for free.
What version of SCCM/IIS are you running? The latest version resolves most of the issues with the IIS file restrictions. Prior to having the hot fixes I would simply rename the file extensions from their original name to a .txt and when the files were local on the system, rename them with the installation script. Since upgrading to client version .2187 (not the most current) I haven't had issues with files extensions. I have 4 hot fixes installed, mainly one to fix AI, WMI, and USMT issues.
Deploying Autodesk would be tricky because of the size. I'm not aware if it has HKCU settings but I'm going to assume it doesn't for ease though. Basically I would set an advertisement a few days to weeks in advance of the installation date. This would allow time for the application to copy down to the client system. When the advertisement date is reached it'll kick off the installations depending on how you have them configured.
This is how I upgraded from Office 2007 to Office 2010 with minimal impact.
I haven't installed autodesk through SCCM. Previously that was part of my base image along with Office to ease the installation. Depending on your environment and situation it'll be different.
Regarding how the client works. Essentially you create your package, update the DPs, and send out an advertisement. The clients check in, by default, every 60 minutes. When it sees it has a new advertisement it'll start trying to download from the local DP (Site settings on the primary). Once it finishes downloading it'll refer to the advertisement as to when/how to install. If you do not install when the user is logged in (most cases) it'll install as the System Account. If that fails it will try to use the Primary SCCM server account to install (as SYSTEM).
On the PXE VM, you have to specify a different NIC for the VM. Offhand I can't remember but I think you only get 3 options. You'll also need to have IP Helpers or DHCP configured with options 67/68 or 68/69 to get PXE working. It depends on your environment.
Generally, to troubleshoot software installs you can run the PSTools with the psexec as mentioned to test your script. You'll have to dig through a few logs depending on how you initiate the deployment.
Refreshing the Machine policy will update deployments to the computer and User will catch advertisements based against the user.
When you refer to "normal" installers, what do you mean? How do you generally install software? Older stufff I can see being an issue, most things could be a command line, MSI/MST, or some other provided tool to install it.
You can also use "Command Line Builder" to run against an app to figure out what the exact command line is you would need to use to install.
The binary differential is really worthless in most cases unless you're sending out a WIM or lager single file.
What's your BITS currently set to?
DP distribution in a hierachy with T1 connections would be set to 256Kb/Pulse mode. Everything else sucks. Some people use less depending but I never had issues at 256. Some use less, it depends on what you have available.
What's your setup like? Unless you have over 100k clients you should be a single primary with multiple DPs and/or secondary sitse. I'd personally avoid BDPs because they're painful.
Mixed or Native mode?
I'm already using trace32, but I've got a hard time figuring out which log file contains what information. In particular we seem to sometimes not have the clients receive advertisements. Sometimes because collections haven't been updated but mostly because of os restrictions or some other stuff - and twice we had to restart the sccm server to make it send updates.
Regarding autodesk - you don't know it I assume. Autodesk software, like solidworks, deploys directly from a network share. It isn't simply a bunch of files copied down to a local share and then started with msiexec. From a network bandwidth perspective though, our 1Gbit mpls handles adobe cs4 and arcgis fine, which both are around 5gb. But autodesk can't be deployed by copying it down locally, and it wouldn't be a good idea to do anyway as it only needs about 60% of the data on the share to install, depending on os. Basically my problem with autodesk software is, that in order to deploy it, I've had to have the fileserver guys create a share where 'everyone' has read access. I don't much like that.
Regarding the pxe issue. If I select the e1000 nic in 32bit guests it'll work, but it'll still fail to detect the harddrive. I've tried ide and all scsi variants. All fail. Seems txt drivers (or whatever it's called in vista+) aren't included by microsoft for any of those controllers. I don't know how to add those to the boot wim though.
What I mean by normal installers, are the ones that come with the products. I work for a service provider that deploys software to our clients computers. We've got 218 advertised programs at the moment. Not all of them are current modern software. And even some that is doesn't use msi, installshield, nullsoft or any other normal installer with silent deployment options. This is the reason I'm deploying a lot of our software with complicated batch scripts or in some cases repackage software in wise package studio.
I don't think I know what the command line builder is. I seem to have seen that line somewhere though.
I don't know the answers to the version and bits mode questions. We had some external expert help us set up the sccm system back then, and I joined the sccm team later.
What I CAN tell you is, that we have roughly 2300 clients, 1DP which is also the sccm 2007 server itself. We moved the sql to the local system due to performance and reliability issues with the dedicated sql server, and in the first week of this year I upgraded the server to 24GB memory as the sql is using roughly 13GB. It's a physical server, unlike most of the other ones we have, so it doesn't share bandwidth with anything else.
Our network is set up with
the sccm plugged into the main backbone switch array I think, and we've got 1Gbit links between our server park and each of the sattelite addresses. We're doing surprisingly well with pxe'ing 60 computers at once over that 1Gbit (compared to the old wds systems we used previously, or the ghost ones in the early parts of this millenia).
We used to have a secondary deployment point, but we've surrendered that server room due to cost cutting at some point, so we obviously don't have equipment there anymore. But that too was before I joined the sccm team that, at the time, consisted of only one person.
To check your client version, open Control Panel - Configuration Manager, and on the General Tab you should see what version the client is. In order to install those updates beyond .2000, the server has to be updated first.
Having the SQL server local is recommended and will provide the best performance.
On Autodesk you have a network share and a central license manager? I haven't touched CAD programs in 3-4 years. Those will be difficult because you don't have much of an option to deploy locally. The catch being that since everything is accessing a share and not working through SCCM, normal network limitations take place. SCCM will stream only so many connections at a time and does it in fairly calculated manner to give the best performance. This isn't the case with regular Shares. I would guess you would set it to install in off hours and in stages. Ultimately creating multiple collections and multiple advertisements, each staggering when it installs.
I haven't worked with VMs in Xencenter, mainly VMWare since that is the recommended path. I'm not a Citrix person enough to know what is needed for the hard drives.
Though, in order to add drivers to the boot media it can be a process. First, you need to import the driver into the Drive Database. Then, would have to open the Boot Media (most likely 32 bit one, very few use the 64 bit) and you can simply click a few buttons and add the driver. That part is fairly straight forward. From there you'll need to update your DP with the new media and try the PXE boot again, or burn it to media and see if accesses the hard drives. Finding drivers is probably one of those most unknown and time consuming tasks.
Powershell command line building:
Batch command line builder (plenty of versions out there)
It may come down to putting a 'wrapper' around a lot of the older software or software that doesn't play nicely. That is common in some applications like Flash, Java, and sometimes other Adobe products. Older applications will most likely work best with batch/command line.
2300 clients with 1 DP will work, having a second one might not be a bad idea. It would depend on how much is getting deployed to how many at any given time. SQL will eat up all the memory you give it over time so make sure you set it to leave 4GB for the OS - you do this from within SQL Configuration Manager on the SQL server.
Overall though for logs.. I find first I look at the server and ContentTransfer/DataTransfer to make sure the package is getting to my DP. On the client side I make sure CCMExec.log looks ok, then I look at DataTransfer.log (it'll tell you where it is talking and what it is looking to get). ExecMgr.log records what kicked off, if anything.
You can also use the reporting to view the status of an advertisement to see where things are in the process.
This is all high level though. Specific questions get specific answers... overall, it'll take about 6-8 months really understand the log files. Working with all of SCCM will take at least a year of every day hands on to grasp how it works.
a year ? I've been in the sccm group for about that long I think, but I've left it alone much of the time. I package software and create advertisements mostly ; and make custom report queries when someone needs it. A very handy thing that one. And only took me a friday afternoon to learn enough sql
Edit: Wise package studio has a command line builder sorta like the one you linked. It doesn't work very well though (like most of wise package studio). Don't think the powershell one's very attractive. Been on a powershell course last year. Good intentions exceptionally badly executed by microsoft.
I lived SCCM for a year, almost all aspects of it, before I really could grasp it. I've met some people who have been on it for years and still don't know much about it.
Technet doesn't cover much.. most of what I get is from MyItForums.. they're heavily focused on 2012 now though. But lots of older material out there.