PC Review
Forums
Newsgroups
Windows XP
Windows XP WMI
Setting computer name with WMI
Forums
Newsgroups
Windows XP
Windows XP WMI
Setting computer name with WMI
![]() |
Setting computer name with WMI |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Junior Member
|
Greetings,
I have been trying to figure out how to set computer name with WMI in C++. Below is part of the code to help demonstrate what I am doing. VARIANT varCommand; varCommand.vt = VT_BSTR; //New computer name varCommand.bstrVal = L"NewHostName01"; //Property that I wish to change is Name hr = pInInst->Put(L"Name", 0, &varCommand, 0); IWbemClassObject * pOutInst = NULL; // Execute Rename method from class Win32_ComputerSystem hr = pNamespace->ExecMethod(L"Win32_ComputerSystem", L"Rename",0,NULL, pInInst, &pOutInst, NULL); ExecMethod fails with following error message: WBEM_E_INVALID_METHOD_PARAMETERS. I believe "Rename" is a non-static method thus ExecMethod reports preceeding error message. I don't know how to properly code for the non-static case . Need help. Thanksone-trick-pony |
|
|
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 
. Need help. Thanks
