|
Hi Howard Yes I read your link but I did like this instead:
$Log = ".\test.log" $Ws = "ws001"
$Rc = LogCon ( "Start" ) AddGroupWs( ) $Rc = LogCon ( "End" )
Function AddGroupWs ( ) Dim $Group $Domain = "INTRA_AD" $Group = GetObject("WinNT://" + $Ws + "/Administrators,group") If @ERROR < 0 LogCon ("Could not open local group. Error code : @Error" ) Else $Group.Add("WinNT://" + $Domain + "/Domain Users") Select Case @Error = 0 LogCon ("Successful adding of group." )
Case @Error = -2147352567 LogCon ("Group already added." )
Case 1 LogCon ("Could not add group with error code: @Error." )
EndSelect Endif
EndFunction
Function LogCon ( $Msg ) $rc = RedirectOutput("$Log",0) ? "$Msg" $rc = RedirectOutput("") ? "$Msg" EndFunction
I check on the error code and hope that it only give -2147352567 when the group already exist.
/mima
|