Hey Folks,
I am searching for some help on converting a vb script to powershell or just modifying the script so that it will do a couple more things.
I found the vbscript below online and it creates a file that I can import into this visionapp rdp application. The script reads a text file with a list of servernames, then it creates the file as shown in the script and I can import that to the app.
I need to have the script read an excel sheet or csv file though as I need to have more values specified, I need to specify a connectionname, servername, description, and folder name.
Can anyone assist? I appreciate it!
***********************
'*************'Set up basic scripting objects****************************
'Option Explicit
Dim objShell, objFSO, objWSHNetwork
Dim ComputerName, UserName, UserDomain, ScriptName, ScriptNameFull
Set objShell = CreateObject("WScript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objWSHNetwork = CreateObject("WScript.Network")
ComputerName = objWshNetwork.ComputerName
UserName = objWshNetwork.UserName
UserDomain = objWshNetwork.UserDomain
ScriptName = Wscript.ScriptName
ScriptNameFull = WScript.ScriptFullName
'*********************************************************
'define and set object for the Visionapp VRD file - to be imported into desired folder within visionapp
strLogFile= "C:tempserver_import_visionapp.vrd"
Set objLogFile = objFso.CreateTextFile(strLogFile)
'set the servers.txt file which is list of servernames & write initial ine out to the output vrd file
Const ForReading = 1
Set objTextFile = objFSO.OpenTextFile ("c:scriptsservers.txt", ForReading)
mystring = "<?xml version=""1.0"" encoding=""utf-16""?>" & VbCrLf & "<vRDConfigurationFile>"
objLogFile.WriteLine mystring
mystring =""
'loop and do the following for every line in the servers.txt file - this will create the connection for every server in the servers.txt
Do Until objTextFile.AtEndOfStream
strLine = objTextFile.ReadLine
mystring = mystring & VbCrLf & "<Connection Name= """ & strLine & """ ServerName=""" & strLine & """>"
mystring = mystring & vbcrlf & "<Description>" & strLine & "</Description>"
mystring = mystring & vbcrlf & "<Credentials>00000000-0000-0000-0000-000000000000</Credentials>"
mystring = mystring & vbcrlf & "<Audio>false</Audio>"
mystring = mystring & vbcrlf & "<AutoSize>true</AutoSize>"
mystring = mystring & vbcrlf & "<Console>false</Console>"
mystring = mystring & vbcrlf & "<InheritCredentials>true</InheritCredentials>"
mystring = mystring & vbcrlf & "<LocalDrives>true</LocalDrives>"
mystring = mystring & vbcrlf & "<Printer>false</Printer>"
mystring = mystring & vbcrlf & "<ResolutionX>1024</ResolutionX>"
mystring = mystring & vbcrlf & "<ResolutionY>768</ResolutionY>"
mystring = mystring & VbCrLf & "<Serial>false</Serial>"
mystring = mystring & vbcrlf & "<SmartCard>false</SmartCard>"
mystring = mystring & vbcrlf & "<Port>3389</Port>"
mystring = mystring & vbcrlf & "<SeparateWindow>false</SeparateWindow>"
mystring = mystring & vbcrlf & "</Connection>"
objLogFile.WriteLine mystring
mystring = ""
Loop
'write out the final line in the vrd file and close it out
objLogFile.WriteLine "</vRDConfigurationFile>"
objlogfile.Close
WScript.Echo "DONE"
VB Script - help fixing or converting to powershel
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
- virtuallynothere
- Posts: 32
- Last visit: Thu Apr 30, 2015 9:16 am
- virtuallynothere
- Posts: 32
- Last visit: Thu Apr 30, 2015 9:16 am
VB Script - help fixing or converting to powershel
Hey Folks,
I am searching for some help on converting a vb script to powershell or just modifying the script so that it will do a couple more things.
I found the vbscript below online and it creates a file that I can import into this visionapp rdp application. The script reads a text file with a list of servernames, then it creates the file as shown in the script and I can import that to the app.
I need to have the script read an excel sheet or csv file though as I need to have more values specified, I need to specify a connectionname, servername, description, and folder name.
Can anyone assist? I appreciate it!
***********************
'*************'Set up basic scripting objects****************************
'Option Explicit
Dim objShell, objFSO, objWSHNetwork
Dim ComputerName, UserName, UserDomain, ScriptName, ScriptNameFull
Set objShell = CreateObject("WScript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objWSHNetwork = CreateObject("WScript.Network")
ComputerName = objWshNetwork.ComputerName
UserName = objWshNetwork.UserName
UserDomain = objWshNetwork.UserDomain
ScriptName = Wscript.ScriptName
ScriptNameFull = WScript.ScriptFullName
'*********************************************************
'define and set object for the Visionapp VRD file - to be imported into desired folder within visionapp
strLogFile= "C:tempserver_import_visionapp.vrd"
Set objLogFile = objFso.CreateTextFile(strLogFile)
'set the servers.txt file which is list of servernames & write initial ine out to the output vrd file
Const ForReading = 1
Set objTextFile = objFSO.OpenTextFile ("c:scriptsservers.txt", ForReading)
mystring = "<?xml version=""1.0"" encoding=""utf-16""?>" & VbCrLf & "<vRDConfigurationFile>"
objLogFile.WriteLine mystring
mystring =""
'loop and do the following for every line in the servers.txt file - this will create the connection for every server in the servers.txt
Do Until objTextFile.AtEndOfStream
strLine = objTextFile.ReadLine
mystring = mystring & VbCrLf & "<Connection Name= """ & strLine & """ ServerName=""" & strLine & """>"
mystring = mystring & vbcrlf & "<Description>" & strLine & "</Description>"
mystring = mystring & vbcrlf & "<Credentials>00000000-0000-0000-0000-000000000000</Credentials>"
mystring = mystring & vbcrlf & "<Audio>false</Audio>"
mystring = mystring & vbcrlf & "<AutoSize>true</AutoSize>"
mystring = mystring & vbcrlf & "<Console>false</Console>"
mystring = mystring & vbcrlf & "<InheritCredentials>true</InheritCredentials>"
mystring = mystring & vbcrlf & "<LocalDrives>true</LocalDrives>"
mystring = mystring & vbcrlf & "<Printer>false</Printer>"
mystring = mystring & vbcrlf & "<ResolutionX>1024</ResolutionX>"
mystring = mystring & vbcrlf & "<ResolutionY>768</ResolutionY>"
mystring = mystring & VbCrLf & "<Serial>false</Serial>"
mystring = mystring & vbcrlf & "<SmartCard>false</SmartCard>"
mystring = mystring & vbcrlf & "<Port>3389</Port>"
mystring = mystring & vbcrlf & "<SeparateWindow>false</SeparateWindow>"
mystring = mystring & vbcrlf & "</Connection>"
objLogFile.WriteLine mystring
mystring = ""
Loop
'write out the final line in the vrd file and close it out
objLogFile.WriteLine "</vRDConfigurationFile>"
objlogfile.Close
WScript.Echo "DONE"
I am searching for some help on converting a vb script to powershell or just modifying the script so that it will do a couple more things.
I found the vbscript below online and it creates a file that I can import into this visionapp rdp application. The script reads a text file with a list of servernames, then it creates the file as shown in the script and I can import that to the app.
I need to have the script read an excel sheet or csv file though as I need to have more values specified, I need to specify a connectionname, servername, description, and folder name.
Can anyone assist? I appreciate it!
***********************
'*************'Set up basic scripting objects****************************
'Option Explicit
Dim objShell, objFSO, objWSHNetwork
Dim ComputerName, UserName, UserDomain, ScriptName, ScriptNameFull
Set objShell = CreateObject("WScript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objWSHNetwork = CreateObject("WScript.Network")
ComputerName = objWshNetwork.ComputerName
UserName = objWshNetwork.UserName
UserDomain = objWshNetwork.UserDomain
ScriptName = Wscript.ScriptName
ScriptNameFull = WScript.ScriptFullName
'*********************************************************
'define and set object for the Visionapp VRD file - to be imported into desired folder within visionapp
strLogFile= "C:tempserver_import_visionapp.vrd"
Set objLogFile = objFso.CreateTextFile(strLogFile)
'set the servers.txt file which is list of servernames & write initial ine out to the output vrd file
Const ForReading = 1
Set objTextFile = objFSO.OpenTextFile ("c:scriptsservers.txt", ForReading)
mystring = "<?xml version=""1.0"" encoding=""utf-16""?>" & VbCrLf & "<vRDConfigurationFile>"
objLogFile.WriteLine mystring
mystring =""
'loop and do the following for every line in the servers.txt file - this will create the connection for every server in the servers.txt
Do Until objTextFile.AtEndOfStream
strLine = objTextFile.ReadLine
mystring = mystring & VbCrLf & "<Connection Name= """ & strLine & """ ServerName=""" & strLine & """>"
mystring = mystring & vbcrlf & "<Description>" & strLine & "</Description>"
mystring = mystring & vbcrlf & "<Credentials>00000000-0000-0000-0000-000000000000</Credentials>"
mystring = mystring & vbcrlf & "<Audio>false</Audio>"
mystring = mystring & vbcrlf & "<AutoSize>true</AutoSize>"
mystring = mystring & vbcrlf & "<Console>false</Console>"
mystring = mystring & vbcrlf & "<InheritCredentials>true</InheritCredentials>"
mystring = mystring & vbcrlf & "<LocalDrives>true</LocalDrives>"
mystring = mystring & vbcrlf & "<Printer>false</Printer>"
mystring = mystring & vbcrlf & "<ResolutionX>1024</ResolutionX>"
mystring = mystring & vbcrlf & "<ResolutionY>768</ResolutionY>"
mystring = mystring & VbCrLf & "<Serial>false</Serial>"
mystring = mystring & vbcrlf & "<SmartCard>false</SmartCard>"
mystring = mystring & vbcrlf & "<Port>3389</Port>"
mystring = mystring & vbcrlf & "<SeparateWindow>false</SeparateWindow>"
mystring = mystring & vbcrlf & "</Connection>"
objLogFile.WriteLine mystring
mystring = ""
Loop
'write out the final line in the vrd file and close it out
objLogFile.WriteLine "</vRDConfigurationFile>"
objlogfile.Close
WScript.Echo "DONE"
- virtuallynothere
- Posts: 32
- Last visit: Thu Apr 30, 2015 9:16 am
VB Script - help fixing or converting to powershel
To clarify, the above script creates the file correctly, but it only reads a text file that has a single attribute specified.
What would I have to do and how in order to have this script read an excel or csv file so that I can specify more attributes that would get filled in when the file is generated by the script? The strings I need to specify are connectionname, servername, description, and folder.
What would I have to do and how in order to have this script read an excel or csv file so that I can specify more attributes that would get filled in when the file is generated by the script? The strings I need to specify are connectionname, servername, description, and folder.