Login | |
|
 |
Publish Normal.dot to users - 6/16/2006 12:05:00 AM
|
|
 |
|
| |
Weegie
Posts: 6
Score: 0
Joined: 5/9/2006
Status: offline
|
Well, I faced a challenge today. Copy a modified version of normal.dot to every user on a terminal server. Thankfully, it should be easy enough as every user used one terminal server, so no workstations or anything like that. First, I thought I should just copy the files to every user immediately, and came up with this; quote:
Sub deliverfile( strDomain ) Set objDomain = GetObject("WinNT://" & strDomain ) objDomain.Filter = Array( "User" ) originalPath = ("\\UNC\path\to\normal.dot") Set objFSO = CreateObject("Scripting.FileSystemObject") Set checkFSO = CreateObject("Scripting.FileSystemObject") For Each objUser In objDomain installPath = "C:\Documents and Settings\"& objUser.Name &"\Application Data\Microsoft\Maler\" if checkFSO.FileExists(originalPath) Then objFSO.CopyFile originalPath, installpath, true '<------------ else MsgBox "Could not copy to " & installPath end if clear installPath Next End Sub Do strDomain = inputbox( "Please enter a domainname", "Input" ) Loop until strDomain <> "" deliverfile( strDomain ) It failed, saying it could not find the path. on the line marked with '<---------- Hence, I figured "why not let each user copy it upon logon through the logonscript?" and wrote this; [QUOTE] Set objFSO = CreateObject("Scripting.FileSystemObject") Set checkFSO = CreateObject("Scripting.FileSystemObject") Set sh = Wscript.CreateObject("WScript.Shell") wordmal = "\\UNCpath\to\Normal.dot" instPath = (sh.SpecialFolders("AppData") & "\Microsoft\Maler") If checkFSO.FileExists(wordmal) Then objFSO.CopyFile wordmal, instpath, true End If [/QUOTE] which fails with a "permission denied" I admit I am new to VB, but I fail to see why it fails :P Is this behaviour by design, or am I messing it up?
|
|
| |
|
|
|
 |
RE: Publish Normal.dot to users - 6/16/2006 12:37:52 AM
|
|
 |
|
| |
Country73
Posts: 732
Score: 10
Joined: 8/25/2004
From: USA
Status: offline
|
It sounds like a permission issue with your UNC path to the Normal.dot; have you tried connecting directly to that location, outside of the script, to see if they even have access to it? If you have access to that location, do you receive the error message when you run that script?
|
|
| |
|
|
|
|
|