Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Logfile

Status
Not open for further replies.

dukkse

Technical User
Oct 15, 2003
42
US
Hey!!

I have a script that deletes the default profile on a terminal server and replaces it with a new one.
And then changes permissions.
It looks like this:

Dim fso, wshshell, targetdir, sourcedir, cmdCacls, server, txtServer
const tsServersFile = "\\s01-dellmgt\Support$\Batches\terminalservers.txt"
sourcedir="\\keane\common\Default User"

Set fso = CreateObject("Scripting.FilesystemObject")
Set wshshell = Wscript.CreateObject("WScript.Shell")

Set txtServer = fso_OpenTextFile(tsServersFile, forReading, True)
Do While NOT txtServer.AtEndOfStream
server = txtServer.ReadLine
If NOT Server = "" Then ' Check if not empty

targetdir = "\\" & server & "\r$\wtsrv\profiles\Default User"

fso.DeleteFolder targetdir,True

fso.Copyfolder sourcedir, targetdir,true
cmdcacls1 = "cacls " & chr(34) &"\\" & server & "\r$\wtsrv\Default User" & chr(34) & " /E /T /P everyone:R"
wshshell.run cmdCacls1,1

End If

Loop


How can I easiset implement to get this in a text log file??

Thanks
/Daniel
 
It would be easiest to implement your script using a GPO. not sure what you mean by implement it in a text log file? What are you looking to write to text?

Writting text to a file is easy enough:

'==========================================================================
'
' NAME: WriteText2File.vbs
'
' AUTHOR: Mark D. MacLachlan , The Spider's Parlor
' URL: ' DATE : 1/3/2004
'
' COMMENT: Write Text To A Text File
'
'==========================================================================

Set fso = CreateObject("Scripting.FileSystemObject")
Set ts = fso.CreateTextFile ("testfile.txt", ForWriting)
report = "Sample Text"
ts.write report
set ts = nothing
set fso = nothing
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top