Using CSVDE to export computer accounts from AD

I was putting together some documentation and need an export of all computer accounts in Active Directory.

Export Computer Accounts – This will export the DN (distinguishedName, CommonName)
csvde -f output.csv -d “DC=Steve,DC=Schofield,DC=com” -r “(objectClass=computer)” -l cn -j c:

All objects in a specific OU.
csvde -f output.csv -d “OU=My EmailContacts,OU=EmailStff,DC=Steve,DC=Schofield,DC=com” -r “(objectClass=*)” -l mailNickName,cn -j c:

Hope this helps.


Relay Restrictions and SMTP service, IISOLE.dll reference

This is one of *those* posts I refer to from time to time.  There have been a few posts on regarding how to manage relay restrictions in SMTP service.   I’ve used the IISOLE.dll against an IIS 6 server with no issues.  I’ve not tested on IIS 7, so mileage may vary.  Make sure to install the IIS 6.0 compat modules and test on a non-production box.   If nothing else, download a trial version and create an instance using vmware, hyper-V or Virtual PC.

On a side note for SMTP questions.   I’d recommend checking the SMTP / NNTP newsgroup host by Microsoft.   This is an active and targeted source of information for the SMTP service.

Hope this helps.



Day of .NET summary

Attending a local event such as Code Camp, Day of .NET or something similar can be a great way to keep up-to-date on technologies you don’t work with everyday.   These events are usually one day, free of charge and contain a lot of great information.  I attended our local version put on by Chris Woodruff.  I attended the Sharepoint session put on by Rick Kierner   My current role has me doing a lot of Sharepoint / WSS, among other technologies.  Mostly what I’m doing is infrastructure and administration, attending the Day of .NET event introduced me to the developer side.  Here are some links mentioned.

Rick Kierner


40 templates available from MS.


WSP Builder on codeplex


Looking for a place to start (Download the VPC)


Sharepoint dev wiki


Sharepoint logs


I was glad to see Sharepoint has rich logging capabilites, IISLogs (component I wrote) can handle and process logs to keep things under control.   Sharepoint has the ability to automatically clean up logs (which is great!).  However, if you want to keep a few weeks around and zip them up, IISLogs can do the trick.   IISLogsLite 2.0 can handle .log files.


Thanks again Chris, Bill Miller and speakers for putting on a great event.




Steve Schofield

Microsoft MVP – IIS

Cache profile links in MOSS

I was working in MOSS recently and couldn’t see the Caching links.   After I activated the Office SharePoint Server Publishing Infrastructure feature, the three Caching links didn’t show up.  I can access them directly.  Here are the links.

Output Caching

Object Caching

Caching Profiles

Additional Resources


Caching in MOSS


Output Caching and Cache Profiles



Response.write saves the day. Display the last X number of event log records using ASP.NET on a remote machine.

It’s been a while since I wrote an ASP.NET app, at least 5 years.  🙂   I needed to query remote servers to get the last X numbers of Event log entries.   One snag I ran into was trying to use the DataGrid or GridView controls.  I kept getting “Index out of bounds” error when trying to write the Message (Description) part of an event log message.   I reverted to my ‘old Classic ASP’ days and used response.write.   I never did find a solution using the built-in controls.   For those who want to allow others to view event logs w/o granting local access, your application pool needs the appropriate permissions.  I setup the application pool to run as a user that can access event logs.  Hope this helps.  PS: I even have color coding! 🙂



<form runat=server id=form1>

<table class=”style1″>
        <td class=”style2″>
            Number of records:</td>
            <asp:DropDownList ID=”DropDownList3″ runat=”server” TabIndex=”0″>
                <asp:ListItem Selected=”True”>10</asp:ListItem>
        <td class=”style2″>
            Machine Name:</td>
            <asp:DropDownList ID=”DropDownList2″ runat=”server” TabIndex=”0″>
            <asp:ListItem Selected=”True”>ServerX</asp:ListItem>
        <td class=”style2″>
            Event Log</td>
            <asp:DropDownList ID=”DropDownList1″ runat=”server” TabIndex=”1″>
                <asp:ListItem Selected=”True”>Application</asp:ListItem>
&nbsp;<br />
<br />
<br />
<br />
<asp:Button ID=”Button1″ runat=”server” Text=”Button” />
    <asp:GridView ID=”GridView1″ runat=”server” AutoGenerateColumns=”False”
        DataKeyNames=”TimeGenerated” EnableTheming=”False” EnableViewState=”False”
        PageIndex=”1″ PageSize=”11″>
            <asp:BoundField DataField=”Message” />
            <asp:BoundField DataField=”TimeGenerated” HeaderText=”Daetime”
                SortExpression=”TimeGenerated” />
            <asp:BoundField DataField=”Source” HeaderText=”Source”
                SortExpression=”Source” />
            <asp:BoundField DataField=”EntryType” HeaderText=”EntryType”
                SortExpression=”EntryType” />
<asp:DataGrid id=”LogGrid” runat=”server”
      <asp:BoundColumn HeaderText=”TOF” DataField=”EntryType” />
      <asp:BoundColumn HeaderText=”Date/Time” DataField=”TimeGenerated”/>
      <asp:BoundColumn HeaderText=”Source” DataField=”Source”/>
      <asp:BoundColumn HeaderText=”Message” DataField=”Message”/>

<HeaderStyle BackColor=”#AAAADD”></HeaderStyle>

<br />




Partial Class _Default
    Inherits System.Web.UI.Page
       Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Page.IsPostBack = True Then
          Response.Write(DropDownList2.Text.ToString() & “<br>”)

            Dim aLog As New Diagnostics.EventLog
   dim z as integer = DropDownList3.Text
            aLog.MachineName = DropDownList2.Text
            aLog.Log = DropDownList1.Text

            ‘LogGrid.DataSource = aLog.Entries

            ‘GridView1.DataSource = aLog.Entries
            Dim y As Integer = 0
            Response.Write(“<table border=2 cellpadding=2 width=’100%’>”)
            Dim item As Diagnostics.EventLogEntry
            For Each item In aLog.Entries
                y = y + 1
                If y = z Then
                    Exit For
                End If
                Response.Write(“<td>” & y & “</td>”)
                Response.Write(“<td>” & aLog.Entries.Item(aLog.Entries.Count – y).EntryType.ToString() & “</td>”)
                Response.Write(“<td bgcolor=’#FFFF99′>” & aLog.Entries.Item(aLog.Entries.Count – y).TimeGenerated.ToString() & “</td>”)
                Response.Write(“<td>” & aLog.Entries.Item(aLog.Entries.Count – y).Source.ToString() & “</td>”)
                Response.Write(“<td bgcolor=’#FFFF99′>” & aLog.Entries.Item(aLog.Entries.Count – y).Message.ToString() & “</td>”)
        End If
    End Sub
End Class

Here is the event log class reference on MSDN