Skip to content

Instantly share code, notes, and snippets.

Avatar

Jon Bryan jkbryan

View GitHub Profile
@jkbryan
jkbryan / mail-adma-export.vb
Last active Oct 14, 2017
FIM/MIM - Email address creation with suffix validation
View mail-adma-export.vb
Case "mail-ADMA-Export"
'MV attributes required are: provisionExchangeMailbox, firstName, sn, initials, company, orgSite, department
'Pump out attribute required for mailbox provision
If mventry.Item("provisionExchangeMailbox").IsPresent Then
If Not csentry.Item("mail").IsPresent Then 'Mail attribute is not present
If mventry.Item("provisionExchangeMailbox").Value.ToLower = "true" Then
'Lets start trying to generate a new email address for this user...
'Start calculating the suffix:
Dim mailSuffix As String = ""
Dim mailPrefix As String = ""
@jkbryan
jkbryan / service_and_portal_reference_for_pam_install.bat
Last active Oct 14, 2017
MIM PAM - Service and Portal PAM Install
View service_and_portal_reference_for_pam_install.bat
@ECHO OFF
REM ********************************************
REM Environment Parameters
ECHO Setting Environment Parameters...
REM ********************************************
SET MSIROOTFOLDER=D:
SET MSILOCATION=%MSIROOTFOLDER%\Service and Portal
SET MSIFILENAME=Service and Portal.msi
SET LOGFILENAME=C:\Temp\%MSIFILENAME%-%time:~0,2%_%time:~3,2%_%time:~6,2%.log
@jkbryan
jkbryan / declarations.vb
Last active Oct 14, 2017
An Alternative To Using The Generic Array From File Function
View declarations.vb
Imports Microsoft.MetadirectoryServices
Imports System
Imports System.directoryservices
Imports ActiveDs
Imports System.Globalization
Imports Microsoft.MetadirectoryServices.Logging
Imports System.IO
Imports System.Xml
Public Class MAExtensionObject_MYADMA
Implements IMASynchronization
@jkbryan
jkbryan / adou-group-adma-import.vb
Last active Oct 14, 2017
Delegating Group Management - Lithnet PSM
View adou-group-adma-import.vb
Case "adOU-Group-ADMA-Import"
mventry("adOU").Value = Replace(csentry.DN.ToString, csentry.RDN.ToString & ",", "")
@jkbryan
jkbryan / mail-adma-export.vb
Created Oct 15, 2017
FIM/MIM - Defining a Unique Email Address
View mail-adma-export.vb
Case "mail-ADMA-Export"
'MV attributes required are: provisionExchangeMailbox, firstName, sn, initials, company, orgSite, department
'Pump out attribute required for mailbox provision
If mventry.Item("provisionExchangeMailbox").IsPresent Then
If Not csentry.Item("mail").IsPresent Then 'Mail attribute is not present
If mventry.Item("provisionExchangeMailbox").Value.ToLower = "true" Then
'Lets start trying to generate a new email address for this user...
'Start calculating the suffix:
Dim mailSuffix As String = ""
Dim mailPrefix As String = ""
@jkbryan
jkbryan / declarations.vb
Created Oct 16, 2017
FIM/MIM - Update on my Generic Array From File post
View declarations.vb
Public Class MAExtensionObject_MYADMA
Implements IMASynchronization
'Date & Logginglevel variables for logging files:
Dim dtDateNowHour As Integer = Date.Now.Hour
Dim dtDateNowDay As Integer = Date.Now.Day
Dim dtDateNowMonth As Integer = Date.Now.Month
Dim dtDateNowYear As Integer = Date.Now.Year
Dim loggingLevel As Integer = 0
'
Dim ValidMailSuffixes As ArrayList = generateArrayFromFile("C:\FIMControl\ValidMailSuffixes.txt") ' Extra suffixes can be added to the text file defined here
@jkbryan
jkbryan / emailaddresspresent-adma-import.vb
Created Oct 16, 2017
A Generic Array From File Function To Cope With Inevitable Exceptions
View emailaddresspresent-adma-import.vb
Case "emailAddressPresent-ADMA-Import"
'AD attributes required: mail and msExchHomeServerName
' Default setting = False
mventry("emailAddressPresent").Value = "False"
If csentry("mail").IsPresent And csentry("msExchHomeServerName").IsPresent Then
Dim suffix() As String = Split((csentry("mail").Value), "@") 'mail.Split("@")
'Valid/allowed email suffixes are defined in the following array (amend as appropriate):
Dim validMailAddresses() As String = {"blah.ac.uk", "foo.ac.uk", "bar.ac.uk", "otherorg.ac.uk"}
If (Array.IndexOf(validMailAddresses, suffix(1).ToLower) <> -1) Then
mventry("emailAddressPresent").Value = "True"
@jkbryan
jkbryan / functionalid-owner-expiring-adma-import.vb
Created Oct 19, 2017
Process To Email The Manager Of A Service Account When Their End Date Is Approaching
View functionalid-owner-expiring-adma-import.vb
Case "functionalID-owner-expiring-ADMA-Import"
If csentry.DN.ToString.ToLower.Contains("service") Or csentry.DN.ToString.ToLower.Contains("somethingelse") Then
If mventry("serialNumber").IsPresent Then
Dim AdminEntry() As MVEntry = Utils.FindMVEntries("mail", mventry("serialNumber").Value)
If AdminEntry.Length <> 0 Then
'We got an entry, so work with it... If the employeeEndDate of the parent account is within 30 days, set the flag - used in the portal to email the manager of the account.
If AdminEntry(0).Item("employeeEndDate").IsPresent Then
Dim EndDate As Date = DateTime.ParseExact(AdminEntry(0).Item("employeeEndDate").Value.ToString, "yyyy-MM-ddTHH:mm:ss.000", provider).Date
Dim nowTime As Date = Date.Now.Date.AddDays(30)
If EndDate <= nowTime Then
@jkbryan
jkbryan / console-app.vb
Created Oct 19, 2017
Console App for enumerating userAccountControl integer values
View console-app.vb
Imports ActiveDs
Module Module1
Sub Main()
Dim UACValue1 As Long
Dim UACValue2 As Long
Dim UACValue3 As Long
UACValue1 = ADS_USER_FLAG.ADS_UF_NORMAL_ACCOUNT Or ADS_USER_FLAG.ADS_UF_DONT_EXPIRE_PASSWD And (Not ADS_USER_FLAG.ADS_UF_ACCOUNTDISABLE)
UACValue2 = ADS_USER_FLAG.ADS_UF_NORMAL_ACCOUNT Or ADS_USER_FLAG.ADS_UF_PASSWD_CANT_CHANGE Or ADS_USER_FLAG.ADS_UF_TRUSTED_TO_AUTHENTICATE_FOR_DELEGATION
UACValue3 = ADS_USER_FLAG.ADS_UF_NORMAL_ACCOUNT Or ADS_USER_FLAG.ADS_UF_SMARTCARD_REQUIRED Or ADS_USER_FLAG.ADS_UF_TRUSTED_FOR_DELEGATION
@jkbryan
jkbryan / lookup_set_ie_vpn_proxies.vbs
Created Oct 19, 2017
Amending/ Changing IE Proxy Settings Cont
View lookup_set_ie_vpn_proxies.vbs
' LOOKUP_SET_IE_VPN_PROXIES.VBS
' Jon Bryan Jan 2016
' Run as a user logon script, via GPO.
' Fixes those defined VPN Proxy settings "SITE1 PPTP" and "SITE1 VPN" - no tick boxes or text boxes filled.
' Retains and enforces the normal value for SITE2 based VPN Proxy settings.
' Will replace the existing SET_IE_VPN_PROXIES.VBS script, if the expected VPN Proxy settings are not found, they are added.
'
OPTION EXPLICIT
ForceScriptEngine("cscript")
Const HKEY_CURRENT_USER = &H80000001
You can’t perform that action at this time.