Help! Cannot deploy this script with SCCM

Author Message
gurltech

  • Total Posts : 19
  • Scores: 2
  • Reward points : 17530
  • Joined: 8/1/2008
  • Status: offline
Help! Cannot deploy this script with SCCM Friday, April 06, 2012 10:06 AM (permalink)
0
What am I doing wrong?
It works when I deploy it manually by logging in with my domain admin account and right click run as administrator.
Here is the script, what wrong with it.
This is part of my Office 2010 deployment.
@echo off  
rem A basic script to copy .officeUI files from a network share into the user's local AppData directory, if no .officeUI file currently exists there.
rem Can easily be modified to use the roaming AppData directory (replace %localappdata% with %appdata%) or to include additional ribbon customizations.   
 
setlocal[/style]
set userdir=%localappdata%\Microsoft\Office[/style]
set remotedir=\\MyServer\LogonFiles\public\OfficeUI  [/style]
for %%r in (Word Excel PowerPoint) do if not exist %userdir%\%%r.officeUI cp %remotedir%\%%r.officeUI %userdir%\%%r.officeUI[/style]
endlocal[/style]
 
Any help you can give me would be appreciated.[/style]
[/style]
“App Deployment is an art form that's easily mastered, App Packaging however is Dark Magic and can take a life time to master.”
 
#1
    bmason505

    • Total Posts : 3262
    • Scores: 244
    • Reward points : 78070
    • Joined: 1/23/2003
    • Location: Minneapolis, MN
    • Status: offline
    Re:Help! Cannot deploy this script with SCCM Friday, April 06, 2012 11:20 AM (permalink)
    4
    You are copying using domain admin to reach that share.  CM doesn't do that.  It can use the network access account or the machine acct of the workstation to copy.  So grant domain computers read on that share or the network access acct.  Or preferably, copy what's on that share into your package and let CM deliver it to the cache folder.
    Brian Mason
    MCTS\MS MVP - ECM 
    http://www.mnscug.org/
     
    #2
      gjones

      • Total Posts : 2291
      • Scores: 136
      • Reward points : 97820
      • Joined: 6/5/2001
      • Location: Ottawa, Ontario, Canada
      • Status: offline
      Re:Help! Cannot deploy this script with SCCM Friday, April 06, 2012 11:41 AM (permalink)
      4
      To expand upon Brian’s comment, you can simulate what CM07 does on the local workstation by running a command prompt as the local system. Here is how to do it. http://verbalprocessor.com/2007/12/05/running-a-cmd-prompt-as-local-system/
       
      #3
        jdismukes

        • Total Posts : 2
        • Scores: 0
        • Reward points : 19240
        • Joined: 2/4/2004
        • Status: offline
        Re:Help! Cannot deploy this script with SCCM Friday, April 06, 2012 12:12 PM (permalink)
        0
        You can also use Pushd   instead of set remotedir=\\MyServer\LogonFiles\public\OfficeUI.   This will map the next availabe drive and automatically change you to that directory.  Useful for the times you need a drive letter vs just a path.  In this case the out come would be something like L:\public\OfficeUI.  Once you are finished, type Popd towards the end of the batch file and it unmaps the drive for you.
         
        I find it useful for when you have an install that has to be run from a mapped drive or at times has to be run from a specific directory on the local machine.  Pushd to the directory/share you need to copy something from then xcopy *.* /s /y whatever localdir you need.

        That and if you run it in a normal mode with echo on, you can see if there are any permissions issues when it tries to map the drive.

        Nothing fancy, but you may find it useful at some point.  :)
         
         
        #4
          colin

          • Total Posts : 4
          • Scores: 0
          • Reward points : 1810
          • Joined: 4/23/2012
          • Status: offline
          Re:Help! Cannot deploy this script with SCCM Tuesday, April 24, 2012 4:49 AM (permalink)
          0
          I'm  new to giving advice rather than asking for it, but Id consider checking what account is being used to run your script - if its set to run with admin rights,(on the program, environment tab) then it runs under the local system account. That being the case I think your script will struggle with this bit -
           
           set userdir=%localappdata%\Microsoft\Office[/style]  

           
          as it will be trying to use the localappdata path for the SYSTEM user.
           
          When ive done things like this in the past I've used VB to grab a profile list from the registry and then carry out actions for each individual profile. Alternativly, you can set the job to 'run with user rights' and that will at least test the theory.
           
          To help with testing, you can use psexec (free tool, just google it) to run a script as the SYSTEM user rather than as your user elevated. 
           
          Sorry for any repetition - did something really odd there and didn't notice other replies. 
          Regards
           
          Colin
           
           
          <message edited by colin on Tuesday, April 24, 2012 5:05 AM>
           
          #5
            Granwalla

            • Total Posts : 2
            • Scores: 0
            • Reward points : 100
            • Joined: 5/23/2012
            • Status: offline
            Re:Help! Cannot deploy this script with SCCM Wednesday, May 23, 2012 11:29 PM (permalink)
            0
            My first thought is that you have to manually kick it off as an admin locally to get it to work, so how does your package kick it off as an admin?  Is it in the package, or are your users local admins?  That might be the problem . . . just putting it out there.
             
            #6
              Online Bookmarks Sharing: Share/Bookmark

              Jump to:

              Current active users

              There are 0 members and 1 guests.

              Icon Legend and Permission

              • New Messages
              • No New Messages
              • Hot Topic w/ New Messages
              • Hot Topic w/o New Messages
              • Locked w/ New Messages
              • Locked w/o New Messages
              • Read Message
              • Post New Thread
              • Reply to message
              • Post New Poll
              • Submit Vote
              • Post reward post
              • Delete my own posts
              • Delete my own threads
              • Rate post

              2000-2013 ASPPlayground.NET Forum Version 3.9