Have some trouble with this one..
The code below is taken from microsofts site -
As it is now the script works, but...
If i moify it to this then it doesnt work. The comp name is not renamed.
A: This can not be done!
B: Typo
C: Just wrong!
If A Then OK
Else
If B Then Pls Help me!
Else If
If C Whats wrong?
End If
Next
The code below is taken from microsofts site -
As it is now the script works, but...
Code:
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colComputers = objWMIService.ExecQuery _
("Select * from Win32_ComputerSystem")
For Each objComputer in colComputers
err = objComputer.Rename("WebServer")
Next
If i moify it to this then it doesnt work. The comp name is not renamed.
Code:
strCompN = "COMP1"
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colComputers = objWMIService.ExecQuery _
("Select * from Win32_ComputerSystem")
For Each objComputer in colComputers
err = objComputer.Rename(&strCompN)
Next
A: This can not be done!
B: Typo
C: Just wrong!
If A Then OK
Else
If B Then Pls Help me!
Else If
If C Whats wrong?
End If
Next