johnbaird Absent Member.
Absent Member.
2565 views

Deleting orphaned users

Has anyone figured a way to remove users from GroupWise when their
corresponding NDS user has already been deleted? pIADUSER->Delete(eadGW)
returns success as does pIADUSER->Delete(eadBothNDSandGW) but in both
cases the user is not deleted from GroupWise. I've worked though various
possiblities without success, including recreating a user of the same
name and context, but another limitation of the API means its not
possible to relink them whereas ConsoleOne can.

I have someone with several thousand such users to delete but to date
have been unable to achieve this using the GroupWise Admin Object API.
Has anyone achieved this?

TIA, John
DevSup SysOp 24

Labels (1)
0 Likes
3 Replies
Anonymous_User Absent Member.
Absent Member.

Re: Deleting orphaned users

John Baird schrieb:
> Has anyone figured a way to remove users from GroupWise when their
> corresponding NDS user has already been deleted? pIADUSER->Delete(eadGW)
> returns success as does pIADUSER->Delete(eadBothNDSandGW) but in both
> cases the user is not deleted from GroupWise. I've worked though various
> possiblities without success, including recreating a user of the same
> name and context, but another limitation of the API means its not
> possible to relink them whereas ConsoleOne can.
>
> I have someone with several thousand such users to delete but to date
> have been unable to achieve this using the GroupWise Admin Object API.
> Has anyone achieved this?
>
> TIA, John
> DevSup SysOp 24
>

i had the same problem


create a temporary nds user

foreach gw account

replace "ngw:groupwise id" attribute (from your temporary nds user )
with domname.poname.gwaccountname{106} gw dom id

associate the gw account to nds account with
addexistinguser(gwacccountname, nds user dn, "", PO, DOM, mailboxid form gw acccount);
delete gwaccount using Delete(eadGW)


this my perl script
its only a sample -> it deletes users where

username starts not with 1
and username doesnt contain a -



---------------------------------

use Win32::OLE;
use Net::LDAP qw(:all);

$ldap=Net::LDAP->new(" YOUR SERVER IP ") or die $@;
$error = $ldap->bind ('cn=admin,ou=NETWORK,o=SERVER',password =>' 🙂 ',version=>'3') or die "Fehler bei bind: $@\n";

if( $error->error ne Success){
die "Bind error -> " . $error->error . "\n";
}

$gw=Win32::OLE->new('NovellGroupWareAdmin');
$gw->ConnectByDN("dom_bszl.groupwise.bszl.schulen");
$objDomain=$gw->ConnectedDomain();

$objPostOffices = $objDomain->PostOffices();
$objPostOffice = $objPostOffices->Item("po_pupil");

$objUsers = $objPostOffice->Users();
$objUsersIterator = $objUsers->CreateIterator();
print "adding tempuser\n";
$ldap->add("cn=tempuser,o=SCHULEN",
attr=>['objectclass'=> "inetorgperson",
'surname' => "tempuser",
]
);

$mesg = $ldap->search(
base=>'cn=tempuser,o=SCHULEN',
scope => 'base',
filter => '(objectclass=inetorgperson)'
);


$entry = $mesg->entry(0);

while( $objUser = $objUsersIterator->Next() ){
$username = $objUser->{'Name'};
if($username !~ /^1|-/){
$entry->replace("ngwGroupwiseID",'DOM_BSZL.po_pupil.' . $username . '{106}13F67730-0F80-0000-918F-770055005D00');
$entry->update($ldap);

$objUsers->AddExistingUser($username, "tempuser.SCHULEN","", "po_pupil", "DOM_BSZL", $objUser->{MailboxID});
$objUsers = $objPostOffice->Users();
$objUser = $objUsers->Item($username);
print "delete $username ....\n";
while($objUser){
$objUser->Delete(1);
undef $objUser;
$objUser = $objUsers->Item($username);
}
print "deleted $username -> OK\n";
}
}

print "deleting tempuser\n";
$ldap->delete("cn=tempuser,o=SCHULEN");
$ldap->unbind();


0 Likes
johnbaird Absent Member.
Absent Member.

Re: Deleting orphaned users



torsten wrote:

> John Baird schrieb:
> > Has anyone figured a way to remove users from GroupWise when their
> > corresponding NDS user has already been deleted? pIADUSER->Delete(eadGW)
> > returns success as does pIADUSER->Delete(eadBothNDSandGW) but in both
> > cases the user is not deleted from GroupWise. I've worked though various
> > possiblities without success, including recreating a user of the same
> > name and context, but another limitation of the API means its not
> > possible to relink them whereas ConsoleOne can.
> >
> > I have someone with several thousand such users to delete but to date
> > have been unable to achieve this using the GroupWise Admin Object API.
> > Has anyone achieved this?
> >
> > TIA, John
> > DevSup SysOp 24
> >

> i had the same problem
>
> create a temporary nds user
>
> foreach gw account
>
> replace "ngw:groupwise id" attribute (from your temporary nds user )
> with domname.poname.gwaccountname{106} gw dom id
>
> associate the gw account to nds account with
> addexistinguser(gwacccountname, nds user dn, "", PO, DOM, mailboxid form gw acccount);
> delete gwaccount using Delete(eadGW)


Torsten

Thanks for that, I have this working. I note though that you hard coded the object ID which forms the final part of each value for "NGW:
GroupWise ID". Do you know how to retrieve that programmatically from GroupWise? It is not the object ID of the domain, calling
pIADDomain->get_ObjectID returns a different ID. I suspect that it is the ID for the system object but get_ObjectID is not valid for
pIGWSystem. I can retrieve this from the "NGW: GroupWise ID" attribute of either the user's domain or post office NDS object, but can it be
retrieve from GW itself?

TIA, John
DevSup SysOp 24

0 Likes
Anonymous_User Absent Member.
Absent Member.

Re: Deleting orphaned users

John Baird schrieb:
>
> torsten wrote:
>
>
>>John Baird schrieb:
>>
>>>Has anyone figured a way to remove users from GroupWise when their
>>>corresponding NDS user has already been deleted? pIADUSER->Delete(eadGW)
>>>returns success as does pIADUSER->Delete(eadBothNDSandGW) but in both
>>>cases the user is not deleted from GroupWise. I've worked though various
>>>possiblities without success, including recreating a user of the same
>>>name and context, but another limitation of the API means its not
>>>possible to relink them whereas ConsoleOne can.
>>>
>>>I have someone with several thousand such users to delete but to date
>>>have been unable to achieve this using the GroupWise Admin Object API.
>>>Has anyone achieved this?
>>>
>>>TIA, John
>>>DevSup SysOp 24
>>>

>>
>>i had the same problem
>>
>>create a temporary nds user
>>
>>foreach gw account
>>
>>replace "ngw:groupwise id" attribute (from your temporary nds user )
>>with domname.poname.gwaccountname{106} gw dom id
>>
>>associate the gw account to nds account with
>>addexistinguser(gwacccountname, nds user dn, "", PO, DOM, mailboxid form gw acccount);
>>delete gwaccount using Delete(eadGW)

>
>
> Torsten
>
> Thanks for that, I have this working. I note though that you hard coded the object ID which forms the final part of each value for "NGW:
> GroupWise ID".
> Do you know how to retrieve that programmatically from GroupWise? It is not the object ID of the domain, calling
> pIADDomain->get_ObjectID returns a different ID. I suspect that it is the ID for the system object but get_ObjectID is not valid for
> pIGWSystem. I can retrieve this from the "NGW: GroupWise ID" attribute of either the user's domain or post office NDS object, but can it be
> retrieve from GW itself?
>
> TIA, John
> DevSup SysOp 24
>


no the gw api doesnt seems to provide such a funktion 😞
at least i haven't found anything

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.