473,811 Members | 3,213 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

[ActiveDirectory] Set logonHours ?

Hi,

How can i set the LogonHours to users, using System.Director yServices?

I think I must create a byte array, but it doesn't work.
Thanks in advance, JBrek
Nov 17 '05 #1
2 3921
>How can i set the LogonHours to users, using System.Director yServices?
I think I must create a byte array, but it doesn't work.


Yes, that's exactly how you do it - can you show us the code that
you're using? What is not working? Do you get an error? Where, and
what exactly is it?

Marc
Nov 17 '05 #2
So, the code I used to send logonhours data to AD :

DirEntry.Proper ties["logonHours "].Value = baLogonHours as object; //
baLogonHours = byte[]

the code I used to create the byte array :
private byte[] ArrayTologonHou rs(bool[,] arrblnLogonHour sA)
{
byte[] byteLogonHour = new byte[21];

// Mise en forme avec changement de l'ordre de la semaine
int index21 = 0;
int index24 = 0;
for(int i=1; i <= 7; i++)
{
for(int j=1;j <= 3;j++)
{
byte byte8Hours = new byte();
for(int k=7; k >= 0; k--)
{
if (i < 7)
{
if (arrblnLogonHou rsA[i,index24])
byte8Hours += (byte)Math.Pow( 2, (double)k);
}
else
{
if (arrblnLogonHou rsA[0,index24])
byte8Hours += (byte)Math.Pow( 2, (double)k);

}
index24++;
}
byteLogonHour[index21] = byte8Hours;
index21++;
}
index24 = 0;
}
return byteLogonHour;
}

I got this error :
"Erreur non spécifiée
Active Directory at System.Director yServices.Inter op.IAds.PutEx(I nt32
lnControlCode, String bstrName, Object vProp)
at System.Director yServices.Prope rtyValueCollect ion.set_Value(O bject
value)"

at the line where I send the datas to AD...

What is the problem ? Thank you in advance...
JBrek
"Marc Scheuner [MVP ADSI]" wrote:
How can i set the LogonHours to users, using System.Director yServices?
I think I must create a byte array, but it doesn't" work.


Yes, that's exactly how you do it - can you show us the code that
you're using? What is not working? Do you get an error? Where, and
what exactly is it?

Marc

Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1395
by: Dirk Hagemann | last post by:
Hi! I'm working in an ActiveDirectory Network and want to get some information about a user-account or computer (OS for example) account. I think this works with the win32com.client module and the LDAP-Path, but I couldn't find yet a simple and working sample-script just to test some things or have a first small success. Does anybody know a simple example for this task? The ActivePython Documentation was no real help yet and scripts I...
2
3709
by: bob | last post by:
Hi, Is this the right place to dicuss Visual Studio 2005 and .Net 2? I am try to implement a class (already using Windows Authentication) where I am given a user name and I return a list of groups to which the user is a member. In .Net 1.1, I can use the System.DirectoryServices.ActiveDirectory namespace; but what do I use in .Net 2?
4
15063
by: Sargas Atum | last post by:
Hi all, I am trying to get the field "lastLogon" out of ActiveDirectory. It should be trivial I thought, but it is not, as I have experienced. private DataRow FillDataRow( DataRow dataRow, PropertyValueCollection property , string columnName ) { if( columnName.Equals("Last Login") && property.Value != null )
0
1070
by: dhnriverside | last post by:
Hi guys I want to find out which of my ActiveDirectory users is logged on to a particular ActiveDirectory Computer. I can get what Computer a user is logged on to with Dns.Resolve(Request.ServerVariables).HostName; But I want to create a list of the computers on the network, with whos
0
1600
by: Uchi | last post by:
I was able to get the full details about the user by searching. but it does nt have a value called logonhours. how do i get the logonhours of a user using ldap in php Thanks. Uchi
0
1524
by: =?Utf-8?B?dGhsMTAwMA==?= | last post by:
Hi, i need help getting the logonHours from AD for a specific user. I found a vbscript doing exactly what i want: On Error Resume Next Dim arrLogonHoursBytes(20) Dim arrLogonHoursBits(167) arrDayOfWeek = Array("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat")
6
4426
by: =?Utf-8?B?dGhsMTAwMA==?= | last post by:
Hi NG, i need to list the logonHours for a specific user. I'm trying to convert code from vbscript (is working) to vb.net, but the vb.net code does not work. Here are the code listings: 1: vbscript:
0
1443
by: richardaz | last post by:
I have been working on a project to search for 250,000 different records in ActiveDirectory. The process takes a long time and I have tried everything to make it faster. Currently using System.DirectoryServices, the calls to the server to search for one record is currently taking 2-3 seconds. I tried to throw these requests in the ThreadPool, but was having locking issues on the call to: DirectorySearcher.FindOne();
0
1651
by: myth0s | last post by:
Hi, The question: Is it possible to have two differents ActiveDirectory Membership Provider in web.config and change at run-time from the default provider to the second provider if the first one fail? Context: We are using the ActiveDirectory Membership Provider as part of our authentication solution. It is working great most of the time, but every now and then the AD process on the main server fail. With Windows this is not a...
0
9734
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9607
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10395
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10137
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9211
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6895
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5561
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4346
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3026
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.