logon on remote computer outside domain

  • Thread starter Thread starter Gawel
  • Start date Start date
G

Gawel

Hajo,

I am searching solution for this proble over 2 days.
I need to be able to create mailboxes on exchange server
that is in domain. I need to do it outside of domain.
What is more I can create user outside domain but I can not
create mailbox. Below code throws following exception:
The server is not operational.

IMailboxStore mailBox = (IMailboxStore)user.NativeObject;
mailBox.CreateMailbox(..); <- exception

thanks in adcenve for any help


Gawel
 
Please, post some more code, we can't help you when you don't give us the
LDAP URL in:
mailBox.CreateMailbox(..);

Willy.
 
Willy said:
Please, post some more code, we can't help you when you don't give us the
LDAP URL in:
mailBox.CreateMailbox(..);

Hajo Willy, below I present my code.

DirectoryEntry users = new
DirectoryEntry("LDAP://10.7.0.10/CN=Users,DC=company,DC=local",
"CN=Administrator,CN=Users,DC=company,DC=local",
"password", AuthenticationTypes.ServerBind);

DirectoryEntry user = users.Children.Add("cn=JanKowalski", "user");
user.CommitChanges();
user.Properties["samAccountName"].Value = "JanKowalski";
// enable user: 0x200 ADS_UF_NORMAL_ACCOUNT
// password never expires: 0x10000 ADS_UF_DONT_EXPIRE_PASSWD
user.Properties["userAccountControl"].Value = 0x200 | 0x10000;
user.Invoke("SetPassword", new Object[]{"@@#$%qweqwerA1"});
user.CommitChanges();


ActiveDs.IADsUser adsiUser = (ActiveDs.IADsUser)user.NativeObject;
adsiUser.AccountDisabled = false;

// THIS PART I CAN NOT EXECUTE FROM OUTSIDE OF THE DOMAIN
IMailboxStore mailBox = (IMailboxStore)user.NativeObject;
mailBox.CreateMailbox("CN=Mailbox Store (SPAMERSKI),CN=First Storage
Group,CN=InformationStore,CN=SPAMERSKI,CN=Servers,CN=First
Administrative Group,CN=Administrative Groups,CN=Software
Company,CN=Microsoft
Exchange,CN=Services,CN=Configuration,DC=company,DC=local");

user.CommitChanges();


thanks for quick reply

Gawel
 
Not sure but I guess you need the LDAP://DCServer provider moniker in your
URL.

mailBox.CreateMailbox(LDAP://domainController/CN=Mailbox Store.....)

Willy.

Gawel said:
Willy said:
Please, post some more code, we can't help you when you don't give us the
LDAP URL in:
mailBox.CreateMailbox(..);

Hajo Willy, below I present my code.

DirectoryEntry users = new
DirectoryEntry("LDAP://10.7.0.10/CN=Users,DC=company,DC=local",
"CN=Administrator,CN=Users,DC=company,DC=local",
"password", AuthenticationTypes.ServerBind);

DirectoryEntry user = users.Children.Add("cn=JanKowalski", "user");
user.CommitChanges();
user.Properties["samAccountName"].Value = "JanKowalski";
// enable user: 0x200 ADS_UF_NORMAL_ACCOUNT
// password never expires: 0x10000 ADS_UF_DONT_EXPIRE_PASSWD
user.Properties["userAccountControl"].Value = 0x200 | 0x10000;
user.Invoke("SetPassword", new Object[]{"@@#$%qweqwerA1"});
user.CommitChanges();


ActiveDs.IADsUser adsiUser = (ActiveDs.IADsUser)user.NativeObject;
adsiUser.AccountDisabled = false;

// THIS PART I CAN NOT EXECUTE FROM OUTSIDE OF THE DOMAIN
IMailboxStore mailBox = (IMailboxStore)user.NativeObject;
mailBox.CreateMailbox("CN=Mailbox Store (SPAMERSKI),CN=First Storage
Group,CN=InformationStore,CN=SPAMERSKI,CN=Servers,CN=First
Administrative Group,CN=Administrative Groups,CN=Software
Company,CN=Microsoft
Exchange,CN=Services,CN=Configuration,DC=company,DC=local");

user.CommitChanges();


thanks for quick reply

Gawel
 
Willy said:
Not sure but I guess you need the LDAP://DCServer provider moniker in your
URL.

mailBox.CreateMailbox(LDAP://domainController/CN=Mailbox Store.....)

Hajo,
when I add "LDAP://domainController" prefix then I get
invalid parameter exception.

thanks for your effort

Gawel
 
Make sure your URL looks like
"LDAP://DCServer/CN=...."

Note DCServer is your DC server name/

Willy.
 
Willy said:
Make sure your URL looks like
"LDAP://DCServer/CN=...."

Note DCServer is your DC server name

hajo,

I added LDAP://spamerski/ and then LDAP://spamerski.company.local/
(domain name is company.local, spamerski.company.local is domain
controller)
and always I get System.ArgumentException: The parameter is incorrect :(


Gawel
 
Back
Top