Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Publish Normal.dot to users

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,35485
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Publish Normal.dot to users
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 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?
 
 
Post #: 1
 
 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?

(in reply to Weegie)
 
 
Post #: 2
 
 RE: Publish Normal.dot to users - 6/16/2006 2:48:48 AM   
  Weegie

 

Posts: 6
Score: 0
Joined: 5/9/2006
Status: offline
Changing the UNC path I have not done, but I did change the destination path (to c:), and it worked like a charm once that was done.
I have connected to the UNC path, everyone has read access to it. Domain admins have full...

< Message edited by Weegie -- 6/16/2006 2:51:06 AM >

(in reply to Country73)
 
 
Post #: 3
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Publish Normal.dot to users Page: [1]
Jump to:





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
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts