Hello All,
I have been tasked with creating a script that will go out and find the IBM iSeries Client Access PC5250.ws file on each computer within my clients domain, then edit the ip address within that file.
Here is an example of the file:
[Profile]
ID=WS
Version=9
[printers]
printer=Validator,winspool,COM1:
GraphicGrayScale=N
Raster=N
Drawer1Orient=COR
Drawer2Orient=COR
VTPrintArea=Scroll
VTPrintChar=ASCII
VTTerminator=None
ShowProgress=Y
MultiLinePageHeader=N
MultiLinePageFooter=N
[CT]
trace=Y
[Telnet5250]
HostName=1.1.1.1
AssociatedPrinterStartMinimized=N
AssociatedPrinterClose=N
AssociatedPrinterTimeout=0
Security=CA400
SSLClientAuthentication=Y
CertSelection=AUTOSELECT
[Communication]
Link=telnet5250
Session=5250
[5250]
SessionType=Printer
HostCodePage=037-U
WorkStationID=P33001024V
PrinterType=IBM3812
[Keyboard]
CuaKeyboard=2
Language=United-States
IBMDefaultKeyboard=N
DefaultKeyboard=C:\Program Files\IBM\Client Access\Emulator\private\AS400.KMP
[PrintSessionSetup5250]
Wallpaper=C:\Program Files\IBM\Client Access\Emulator\printsessionsetup.bmp
[LastExitView]
A=3 177 180 976 591 3 12 18 400 0 IBM3270— 37
There are several problems, one - I only know the very basics of vbscripting, two - the file name changes on each pc, to reflect that pc. The file will be located within the same location on each pc, but will have mutiple user profiles on the pc, and of course will have a different name.
The path is: C:\Users\pwatson.ATG\AppData\Roaming\IBM\Client Access\Emulator\private\
Keep in mind the "user" will be different.
The file extension of the file is *.ws
So I tried to use the following as a vbscript, (as a "test" but it isn't working:
Const ForReading = 1
Const ForWriting = 2
on error resume next
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder("C:\Users")
Set colSubfolders = objFolder.Subfolders
For Each objSubfolder in colSubfolders
IF objSubfolder.Name <> "Administrator" THEN
strFolder = objFolder & "\" & objSubfolder.Name & "\C:\Users\pwatson.ATG\AppData\Roaming\IBM\Client Access\Emulator\private"
Set objFolder2 = objFSO.GetFolder(strFolder)
Set colSubfolders2 = objFolder2.Subfolders
For Each objSubfolder2 in colSubfolders2
strfile = objSubfolder2 & "\test.ws"
Set objFile = objFSO.OpenTextFile(strfile, ForReading)
strText = objFile.ReadAll
objFile.Close
strNewText = Replace(strText, "HostName=1.1.1.1", "HostName=2.2.2.2")
Set objFile = objFSO.OpenTextFile(strfile, ForWriting)
objFile.WriteLine strNewText
objFile.Close
Next
END IF
Next
Wscript.echo "End"
Of course the IP's are different than what is listed here. I'm quite sure it wouldn't be right for me to list the IP's being used.
But I'm totally lost here, any help would be GREATLY appreciated! :-)
Sincerely,
Paul Watson
arkansas-it@live.com