Skip to content

Instantly share code, notes, and snippets.

@aleics
aleics / Local active directory (add, edit, delete)
Created May 30, 2015 15:01
How to add, edit and delete active directory users of the local space in C#
//Create a new user on the local active directory
public bool add_user(string user_name, string user_password) {
try {
DirectoryEntry AD = new DirectoryEntry("WinNT://" + Environment.MachineName + ",computer");
DirectoryEntry NewUser = AD.Children.Add(user_name, "user");
NewUser.Invoke("SetPassword", new object[] { password_password });
NewUser.Invoke("Put", new object[] { "Description", user_name });
NewUser.CommitChanges();
@aleics
aleics / Calling methods of a class in Javascript
Last active August 29, 2015 14:22
Sending values to methods of one class (Javascript):
<!-- We can call the function using the onclick function on the html -->
<input type="image" id="sayhi_input" onclick="pop.create('Say hi!')">
<script>
//Declaration of the Class "Popup"
function Popup() {
}
Popup.prototype = {
constructor: Popup, //Construct