Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

WSH et workgroup

2 réponses
Avatar
rénald
Hello,

J'aimerais définir un workgroup et un nom de hôtes en WSH et VBS, dans une
station XP.

Comment faire ?

merci

Rénald

2 réponses

Avatar
Méta-MCI (MVP)
Bonjour !

La commande NET.exe permet de créer des groupes, d'y ajouter ou
enlever des utilisateurs.
Depuis VBS, on peut appeler cette command avec RUN. Mais, AMHA, un
simple batch suffit.

Pour avoir plus d'aide :
net help group
net help user


@-salutations

Michel Claveau
Avatar
Gilles LAURENT [MVP]
"rénald" a écrit dans le message de
news:
| Hello,

Hi !

| J'aimerais définir un workgroup et un nom de hôtes en WSH et VBS,
| dans une station XP.

En VBScript à l'aide de WMI :

--- Coupez ici : RenameComputer.vbs ---
Const cComputerName="CPTNAME"

Set oNet=CreateObject("WScript.Network")
Set oComputer= _
GetObject("winmgmts:/root/cimv2"). _
Get("Win32_ComputerSystem.Name='" & oNet.ComputerName & "'")
nRet=oComputer.Rename(cComputerName)
--- Coupez ici : RenameComputer.vbs ---

--- Coupez ici : JoinWorkgroup.vbs ---
Const cWorkgroupName="WORKGROUP"

Set oNet=CreateObject("WScript.Network")
Set oComputer= _
GetObject("winmgmts:/root/cimv2"). _
Get("Win32_ComputerSystem.Name='" & oNet.ComputerName & "'")
nRet=oComputer.JoinDomainOrWorkgroup(cWorkgroupName)
--- Coupez ici : JoinWorkgroup.vbs ---

En ligne de commande à l'aide de la console WMIC :

RenameComputer :
wmic computersystem where "Name='%computername%'" call Rename
Name='CPTNAME'

JoinWorkgroup :
wmic computersystem where "Name='%computername%'" call
JoinDomainOrWorkgroup Name='WORKGROUP'

--
Gilles LAURENT
MVP Windows Server - Admin Frameworks
http://glsft.free.fr