Category Archives: Script of the Week

INSERT values to a SQL Server table

A recent posting on the PowerShell newsgroup asked, among other things, how easy it is to write data into a SQL Server table.  The question was in relation to storing free disk space from all the servers in the network … Continue reading

Posted in Script of the Week | 2 Comments

Database sizes

After PowerShell one of my favourite Microsoft technologies is SQL Server. I have been working with it since version 6.5 and each new version only gets better. The introduction of SMO with SQL Server 2005 allows me to combine the … Continue reading

Posted in Script of the Week | Leave a comment

Find user with specific home drive

A recent post on the newsgroup aked how can I find a user with a specific homedrive?   Home drive informaton is stored in the homedirectory attribute so a direct approach  like this will work $dom = [System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain()$root = $dom.GetDirectoryEntry() … Continue reading

Posted in Script of the Week | Leave a comment

Disabled Active Directory Accounts

User Accounts in Active Directory can become disabled for a number of reasons including administrative error. Often an account will be disabled when a user leaves and just left in that state until someone gets round to cleaning up the … Continue reading

Posted in Script of the Week | Leave a comment

Writing to EventLogs

Windows has a series of event logs which capture information regarding the activities occurring on a machine. Administrators have found the event logs to be a very good diagnostic tool when things do not seem to be going well. PowerShell … Continue reading

Posted in Script of the Week | 4 Comments

Get SQL Server Version

Microsoft released Service Pack 2 for SQL Server 2005 last week – see http://richardsiddaway.spaces.live.com/blog/cns!43CFA46A74CF3E96!248.entry I have a couple of instances of SQL Server – one in a virtual machine and I have Developer Edition on my laptop. It is relatively … Continue reading

Posted in Script of the Week | Leave a comment

Deleting Empty Folders

Every drive builds up a clutter of empty folders over time.  Every so often I like to tidy up drives that I use so that I don’t have to process empty folders when searching etc.   The following script will … Continue reading

Posted in Script of the Week | 1 Comment