Sample Code (VBScript) - Retrieve MIIS WMI Password History

This is a sample WMI script to retrieve password change history for a specific account through MIIS. You just need to run it on MIIS server with MA name, domain name and account name as parameters. Option Explicit On Error Resume Next Dim ServiceDim CsObjectsDim CsObjectDim ArgumentsDim domainNameDim maDim accountDim MVGuidDim passwordDim oldPasswordDim r Set Arguments = WScript.Arguments.Named…

0

Sample Code (VBScript) - Query CAPICOM

This script queries capicom com object to get cert expiration date. Capicom.dll must be installed and registered in order to run this script. If you need additional cert info, you can just add more CAPICOM Cert object properties to my sample code. Option Expliciton error resume nextConst CAPICOM_MY_STORE = “My”Const CAPICOM_LOCAL_MACHINE_STORE  = 1Const CAPICOM_CURRENT_USER_STORE  = 2Const…

0

Sample Code (VBScript) - Compare Two AD Groups and Get Membership Difference

If you want two AD groups with the same membership but are afraid of mis-sync, I have a sample script to find the delta: On Error Resume NextDim strGroup1, strGroup2, iArgs, oArgs iArgs = Wscript.arguments.countSet oArgs = Wscript.arguments strGroup1 = “cn=” & oArgs(0) & “,ou=ou_name,dc=child_domain_name,dc=parent_domain_name,dc=c0m”strGroup2 = “cn=” & oArgs(1) & “,ou=ou_name,dc=child_domain_name,dc=parent_domain_name,dc=c0m” Set objGroup1 = GetObject(“LDAP://”…

0

Sample Code (C#) - Provision User Accounts and Groups with MIIS

Here is my sample code to provision AD use accounts and groups using MIIS MV Extension: // Use Visual Studio to buildusing System;using Microsoft.MetadirectoryServices; namespace Mms_Metaverse{     public class MVExtensionObject : IMVSynchronization     {          public MVExtensionObject()         {         }          void IMVSynchronization.Initialize ()         {         }          void IMVSynchronization.Terminate ()         {         }   void IMVSynchronization.Provision (MVEntry mventry)  {   ConnectedMA ManagementAgent;   int Connectors;   …

0

Sample Code (T-SQL) - Protecting Identity Data with SQL 2005 Data Encryption

There are multiple ways to protect (encrypt) data with SQL 2005: either using certificate or password. Here is my code sample to use a password to encrypt identity data (assuming the identity table name as tblIdentity_SmartCard table, the identity data column as Identiy_PIN, and GUID as column with primary key): CREATE MASTER KEY ENCRYPTION BY PASSWORD = ‘replace_with_real_password’ CREATE…

0

Sample Code (C++) - Scan Certificate Expiration Date Remotely

It is hard to find a tool to check certificate expiration date on a remote machine without logon locally. Here is my code to accomplish this job: // to build: cl scancert.cpp -link crypt32.lib//—————————————————— #include <windows.h>#include <wincrypt.h>#include <stdlib.h>#include <stdio.h>#include <shlwapi.h>const char *s1 = “\\my”;void listlocalcertstore(char const * const s); void main(int argc, char** argv){   if (argc !=…

1

Sample Code (Command) - Windows Vista Domain Join with smart card

After you require smart card interactive logon in your environment, the traditional domain join will not work because you don’t have a password. Windows Vista resolves this problem by allowing domain join with smart card. However, this new feature will work only if you have Root CA certifcate on smart card. Here is how to…

0