nikolai5005
MIS
I have been working on this problem for about 2 days now, and I did find a way around it; however its really bugging me that I cant figure out how to script this the way that I want to.
Without getting into to much detail about why Im working on this. I use Altiris to capture and deploy images at work, and a recent update broke the way that unattend files are copied to the deployed images.
So I need a VBScript that removes unattend files from the reference computer. I have about 15 different unattend.xml files and they will need to be removed from both the C:\Windows\Panther & C:\Windows\System32\sysprep folders.
I tried looping through all the files in these folders looking for xml extensions. This caused some problems as there are other xml files in these directories that I dont want removed.
I finally ended up with the following code that uses 2 arrays to store the exact names of the unattend.xml's and the other stores the 2 paths that I want these files removed from.
Again while this works perfectly well, it really bugs me to not be able to do exactly what I want to. Please help if you can.
'START CODE THAT I AM NOT HAPPY WITH
Dim objFSO
Set objFSO = CreateObject("Scripting.FileSystemObject")
Dim x(13,0)
x(0,0)="ClassroomBootCampUnattendx64.xml"
x(1,0)="ClassroomRenderFarmUnattendx64.xml"
x(2,0)="ClassroomServerUnattendx32.xml"
x(3,0)="ClassroomServerUnattendx64.xml"
x(4,0)="ClassroomUnattendx64.xml"
x(5,0)="Unattend.xml"
x(6,0)="Untitled.xml"
x(7,0)="VMwareClassroomUnattendx64.xml"
x(8,0)="AdminUnattendx32.xml"
x(9,0)="AdminUnattendx64.xml"
x(10,0)="SecurityUnattendx32.xml"
x(11,0)="SecurityUnattendx64.xml"
x(12,0)="VMwareAdminUnattendx32.xml"
x(13,0)="VMwareAdminUnattendx64.xml"
Dim y(1,0)
y(0,0)="C:\Windows\Panther\"
y(1,0)="C:\Windows\System32\sysprep\"
for i=0 to 13
for j=0 to 0
for k=0 to 1
for l=0 to 0
var = (y(k,l)) & (x(i,j))
If objFSO.FileExists(var) then
objFSO.DeleteFile(var)
end if
next
next
next
next
'END CODE THAT I AM NOT HAPPY WITH
Without getting into to much detail about why Im working on this. I use Altiris to capture and deploy images at work, and a recent update broke the way that unattend files are copied to the deployed images.
So I need a VBScript that removes unattend files from the reference computer. I have about 15 different unattend.xml files and they will need to be removed from both the C:\Windows\Panther & C:\Windows\System32\sysprep folders.
I tried looping through all the files in these folders looking for xml extensions. This caused some problems as there are other xml files in these directories that I dont want removed.
I finally ended up with the following code that uses 2 arrays to store the exact names of the unattend.xml's and the other stores the 2 paths that I want these files removed from.
Again while this works perfectly well, it really bugs me to not be able to do exactly what I want to. Please help if you can.
'START CODE THAT I AM NOT HAPPY WITH
Dim objFSO
Set objFSO = CreateObject("Scripting.FileSystemObject")
Dim x(13,0)
x(0,0)="ClassroomBootCampUnattendx64.xml"
x(1,0)="ClassroomRenderFarmUnattendx64.xml"
x(2,0)="ClassroomServerUnattendx32.xml"
x(3,0)="ClassroomServerUnattendx64.xml"
x(4,0)="ClassroomUnattendx64.xml"
x(5,0)="Unattend.xml"
x(6,0)="Untitled.xml"
x(7,0)="VMwareClassroomUnattendx64.xml"
x(8,0)="AdminUnattendx32.xml"
x(9,0)="AdminUnattendx64.xml"
x(10,0)="SecurityUnattendx32.xml"
x(11,0)="SecurityUnattendx64.xml"
x(12,0)="VMwareAdminUnattendx32.xml"
x(13,0)="VMwareAdminUnattendx64.xml"
Dim y(1,0)
y(0,0)="C:\Windows\Panther\"
y(1,0)="C:\Windows\System32\sysprep\"
for i=0 to 13
for j=0 to 0
for k=0 to 1
for l=0 to 0
var = (y(k,l)) & (x(i,j))
If objFSO.FileExists(var) then
objFSO.DeleteFile(var)
end if
next
next
next
next
'END CODE THAT I AM NOT HAPPY WITH