Hello All,
We have a domain migration up-coming and we will be re-creating all of our user accounts.
I have been looking at the XCACLS.vbs script and I am going to customize it to our needs. There is a procedure in this script that opens a Output File for editing, the problem is I need to be able to append data to the end of the txt file, I have tried changing the parameters for objFileSystem.OpenTextFile(strAbsoluteFile, 8, TRUE) have changed the 8 to 1,3,8 and toggled the True/False argument, it only ever seems to replace the contents of the file, can anyone help with this???
Thanks
Sub OpenOutputFile()
Dim objFileSystem, MyFile, strAbsoluteFile
If Not blnQuiet then
If debug_on then Wscript.Echo "OpenOutputFile: Enter"
End if
Do
If strOutputFile = "" then Exit Do
set objFileSystem = CreateObject("Scripting.FileSystemObject")
If blnErrorOccurred(" opening a filesystem object. (Msg#4201)") Then
strOutputFile = ""
Exit Do
End if
'Open the file for output
strAbsoluteFile = objFileSystem.GetAbsolutePathName(strOutputFile)
If Not objFileSystem.FileExists(strAbsoluteFile) Then
'If it doesn't exist we try to create it.
Set MyFile = objFileSystem.CreateTextFile(strAbsoluteFile, TRUE)
If blnErrorOccurred(" occurred in getting objFileSystem.CreateTextFile(strAbsoluteFile, TRUE) (Msg#4202)") Then Exit Do
MyFile.Close
End If
set objOutputFile = objFileSystem.OpenTextFile(strAbsoluteFile, 8, TRUE)
If blnErrorOccurred(" opening file " & strAbsoluteFile & ". (Msg#4203)") Then
strOutputFile = ""
Exit Do
End if
Exit Do
Loop
Call blnErrorOccurred(" occurred while in the OpenOutputFile routine. (Msg#4204)")
If Not blnQuiet then
If debug_on then Wscript.Echo "OpenOutputFile: Exit"
End if
End Sub
We have a domain migration up-coming and we will be re-creating all of our user accounts.
I have been looking at the XCACLS.vbs script and I am going to customize it to our needs. There is a procedure in this script that opens a Output File for editing, the problem is I need to be able to append data to the end of the txt file, I have tried changing the parameters for objFileSystem.OpenTextFile(strAbsoluteFile, 8, TRUE) have changed the 8 to 1,3,8 and toggled the True/False argument, it only ever seems to replace the contents of the file, can anyone help with this???
Thanks
Sub OpenOutputFile()
Dim objFileSystem, MyFile, strAbsoluteFile
If Not blnQuiet then
If debug_on then Wscript.Echo "OpenOutputFile: Enter"
End if
Do
If strOutputFile = "" then Exit Do
set objFileSystem = CreateObject("Scripting.FileSystemObject")
If blnErrorOccurred(" opening a filesystem object. (Msg#4201)") Then
strOutputFile = ""
Exit Do
End if
'Open the file for output
strAbsoluteFile = objFileSystem.GetAbsolutePathName(strOutputFile)
If Not objFileSystem.FileExists(strAbsoluteFile) Then
'If it doesn't exist we try to create it.
Set MyFile = objFileSystem.CreateTextFile(strAbsoluteFile, TRUE)
If blnErrorOccurred(" occurred in getting objFileSystem.CreateTextFile(strAbsoluteFile, TRUE) (Msg#4202)") Then Exit Do
MyFile.Close
End If
set objOutputFile = objFileSystem.OpenTextFile(strAbsoluteFile, 8, TRUE)
If blnErrorOccurred(" opening file " & strAbsoluteFile & ". (Msg#4203)") Then
strOutputFile = ""
Exit Do
End if
Exit Do
Loop
Call blnErrorOccurred(" occurred while in the OpenOutputFile routine. (Msg#4204)")
If Not blnQuiet then
If debug_on then Wscript.Echo "OpenOutputFile: Exit"
End if
End Sub