This C#, but will get you idea how this can achieved.
private void ChangeServiceName(string oldName, string newName)
{
Process p = new Process();
p.StartInfo.UseShellExecute = false;
p.StartInfo.CreateNoWindow = true;
p.StartInfo.Arguments = string.Format("/c sc config {0} displayname= {1}", oldName, newName);
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
p.StartInfo.FileName = "cmd.exe";
string output = "";
string error = "";
try
{
p.Start();
p.WaitForExit();
output = p.StandardOutput.ReadToEnd();
error = p.StandardError.ReadToEnd();
}
catch (Exception ex)
{
error = ex.ToString();
}
}
VB Code sample, please modify appropriately:
Public Sub RenameService(ByVal OldName As String, ByVal NewName As String)
Dim objProcess As System.Diagnostics.Process
Try
objProcess = New System.Diagnostics.Process()
objProcess.StartInfo.FileName = "cmd.exe"
objProcess.StartInfo.CreateNoWindow = True
objProcess.StartInfo.Arguments = "/c sc config " & OldName & " displayname= " & NewName
objProcess.StartInfo.RedirectStandardOutput = True
objProcess.StartInfo.RedirectStandardError = True
Dim stringOutput As String = ""
Dim stringError As String = ""
objProcess.Start()
objProcess.WaitForExit()
objProcess.Close()
Catch
MessageBox.Show("Could not start process " & ProcessPath, "Error")
End Try
End Sub