Quantcast
Channel: Ivanti User Community: Message List - OS Deployment and Provisioning
Viewing all articles
Browse latest Browse all 3345

Re: Looking for a VBS Script in Provisioning to Name Computer

$
0
0

Ok, then here a quick example of what you can do :

 

strInput = InputBox( "Computer Name:" )

 

 

Const ForReading = 1

Const ForWriting = 2

 

 

UnattendFile = "c:\windows\panther\unattend.xml"

 

 

Set objFSO = CreateObject("Scripting.FileSystemObject")

Set objFile = objFSO.OpenTextFile(UnattendFile, ForReading)

 

 

strText = objFile.ReadAll

objFile.Close

strNewText = Replace(strText, "<ComputerName>%ldHostname%</ComputerName>", "<ComputerName>"& strInput &"</ComputerName>")

 

 

Set objFile = objFSO.OpenTextFile(UnattendFile, ForWriting)

objFile.WriteLine strNewText

objFile.Close

 

 

It might need some changes, it depends of your unattend.xml and it's designed to work with WSCRIPT, not CSCRIPT.


Viewing all articles
Browse latest Browse all 3345

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>