Jump to content

Help writing to a network share


Recommended Posts

I am trying to copy a file to a folder on a network share. The vbscript writes the logged in user to a text file. (This is necessary because this script is running under a system account.) Then I read that text file to get the user name to create the $user directory on the network share.

My code looks like this so far:

RunWait ("cscript.exe thisuser.vbs") ;spawns thisuser.txt
 FileReadLine("thisuser.txt", 1)oÝ÷ Ù±èÁÚµ©¶Wy§KwjÖÜ+×¢¶Ú4ß«¬z¿Û1¬zØ^­è¬mëmz¼ÊØZ´ý½ê/z¹h¢GN«zËh|Ì¢¡×¥¢,)¶¬jëh×6DirCreate ("\\share\docs\profiles\XPTools\migration\Fipsco_Users_MDB_Archive\" & $User & "\MDB")

If FileExists("C:\Fipscocp.mdb")=True Then
  FileCopy ("C:\Fipscocp.mdb", "\\share\docs\profiles\XPTools\migration\Fipsco_Users_MDB_Archive\" & $User & "\MDB\", 1)
EndIf

Thanks for the help,

Link to comment
Share on other sites

What's wrong with @UserName?

@UserName wont work because the script is being run via an Altiris system account and that account overrides the actual logged on user. So instead of writing to the folder JDOE\MDB it writes to SYSTEM\MDB.

Thanks,

Link to comment
Share on other sites

@UserName wont work because the script is being run via an Altiris system account and that account overrides the actual logged on user. So instead of writing to the folder JDOE\MDB it writes to SYSTEM\MDB.

Thanks,

Have you tried...

RunWait ("cscript.exe thisuser.vbs");spawns thisuser.txt
$User = FileReadLine("thisuser.txt", 1)

DirCreate ("\\share\docs\profiles\XPTools\migration\Fipsco_Users_MDB_Archive\" & $User & "\MDB")

If FileExists("C:\Fipscocp.mdb") Then
  FileCopy ("C:\Fipscocp.mdb", "\\share\docs\profiles\XPTools\migration\Fipsco_Users_MDB_Archive\" & $User & "\MDB\Fipscocp.mdb", 1)
EndIf
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...