Export Data to a CSV and Maintain the Column Order

This post provides a simple example of how we can export data to a CSV and maintain the column order: $csvFile = “c:\temp\alkane.csv” $exampledata = @(@(“John”,”37″),@(“Peter”,”14″),@(“Michelle”,”22″),@(“Abdul”,”31″),@(“Roger”,”22″),@(“Rachel”,”50″)) $csvwrapper = @() foreach($person in $exampledata) { $name = $person[0] $age = $person[1] #append … Continue reading

Use ADSI to Set and Clear Active Directory Attributes

This post provides an example of how we can use ADSI to set and clear Active Directory Attributes.  We search for a user called “alkaneuser” and set or clear the department attribute. $objSearcher=[adsisearcher]'(&(objectCategory=person)(objectClass=user)(sAMAccountName=alkaneuser))’ $colProplist = “samaccountname”,”department” foreach ($i in $colPropList) … Continue reading