+ Post New Thread
Results 1 to 6 of 6
O/S Deployment Thread, Copy file to windows\system32\oobe\info\backgrounds in Technical; I am trying to copy a file to the path in the title, using a vbs script. Basically, the vbs ...
  1. #1

    localzuk's Avatar
    Join Date
    Dec 2006
    Location
    Minehead
    Posts
    17,868
    Thank Post
    518
    Thanked 2,486 Times in 1,928 Posts
    Blog Entries
    24
    Rep Power
    838

    Copy file to windows\system32\oobe\info\backgrounds

    I am trying to copy a file to the path in the title, using a vbs script.

    Basically, the vbs script detects the screen resolution on the machine, then copies a relevant jpg to the folder and names it backgroundDefault.jpg.

    Problem is, I cannot get it to run properly in an automated way. If I run it manually, as administrator, it works fine.

    How can I run this script properly as part of an OS deployment task sequence?

  2. #2

    Gatt's Avatar
    Join Date
    Jan 2006
    Posts
    6,678
    Thank Post
    861
    Thanked 650 Times in 431 Posts
    Rep Power
    499
    What error you getting?
    Do the Info\Backgrounds folders exist?

    Is this a 64bit PC? (it may be trying to put them into SysWow64)

    I did create an MSI (using VS2010) for doing this and for setting the registry keys - made it easer to deploy too

  3. #3

    localzuk's Avatar
    Join Date
    Dec 2006
    Location
    Minehead
    Posts
    17,868
    Thank Post
    518
    Thanked 2,486 Times in 1,928 Posts
    Blog Entries
    24
    Rep Power
    838
    Not getting any errors that I can see. It just doesn't run properly.

    The script also checks for and creates the path if it doesn't exist.

    It is a 64bit PC - which is why I'm using a script. My MSI does what you'd expect, and sticks the files in the SysWOW64 folder instead.

    I didn't want to have to go about creating a full software project simply to copy a file to a folder - seems like over complicating it!

  4. #4

    Gatt's Avatar
    Join Date
    Jan 2006
    Posts
    6,678
    Thank Post
    861
    Thanked 650 Times in 431 Posts
    Rep Power
    499
    Theres something about how SCCM handles 32/64 bit - and it can be annoying - normal deployment types have an option for treating stuff as 32 bit when run on 64 bit systems - it affects system32 + syswow64 as well as the registry as well

    not sure about OSD though...

  5. #5

    localzuk's Avatar
    Join Date
    Dec 2006
    Location
    Minehead
    Posts
    17,868
    Thank Post
    518
    Thanked 2,486 Times in 1,928 Posts
    Blog Entries
    24
    Rep Power
    838
    Ok, I'll take it back a step.

    Here's my script

    Code:
      Set filesys = CreateObject("Scripting.FileSystemObject")  
      Const PATH = "C:\Windows\System32\oobe\info\backgrounds\"
      
      BuildFullPath PATH
      
      Set objWMIService = GetObject("Winmgmts:\\.\root\cimv2") 
        Set colItems = objWMIService.ExecQuery("Select * From Win32_DesktopMonitor where DeviceID = 'DesktopMonitor1'",,0) 
        For Each objItem in colItems 
            intHorizontal = objItem.ScreenWidth 
            intVertical = objItem.ScreenHeight 
    		MsgBox(intHorizontal&"x"&intVertical)
    		If filesys.FileExists("background"&intHorizontal&"x"&intVertical&".jpg") Then
    			MsgBox("Yup - "&"background"&intHorizontal&"x"&intVertical&".jpg")
    			filesys.CopyFile "background"&intHorizontal&"x"&intVertical&".jpg", PATH&"backgroundDefault.jpg"
    		Else
    			MsgBox("Nope - "&"background"&intHorizontal&"x"&intVertical&".jpg")
    			filesys.CopyFile "background1280x1024.jpg", PATH&"backgroundDefault.jpg"
    		End If
        Next 
    
    
    Sub BuildFullPath(ByVal FullPath)
    	If Not filesys.FolderExists(FullPath) Then
    	BuildFullPath filesys.GetParentFolderName(FullPath)
    	filesys.CreateFolder FullPath
    	End If
    End Sub
    How should I be executing this? Package? Application? Other?

  6. #6
    thesk8rjesus's Avatar
    Join Date
    Sep 2008
    Posts
    107
    Thank Post
    11
    Thanked 6 Times in 6 Posts
    Rep Power
    14
    With this sort of thing I tend to create a package with no software just point it to the network path. Then in the task sequence add a command line item with the assigned package, and in the command line just put the name of the script. If it goes off to a network location in the script you will need to run the command line as specified user. This works for me

SHARE:
+ Post New Thread

Similar Threads

  1. Replies: 16
    Last Post: 6th December 2012, 11:37 AM
  2. Copy files to another location
    By Chuckster in forum How do you do....it?
    Replies: 7
    Last Post: 23rd October 2009, 02:09 PM
  3. Replies: 0
    Last Post: 25th November 2008, 03:12 PM
  4. Replies: 19
    Last Post: 20th June 2006, 03:53 PM
  5. script to copy files to machines
    By browolf in forum Scripts
    Replies: 1
    Last Post: 28th November 2005, 10:28 AM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •