Monthly Archives: January 2010

Appending to a CSV file

One of the frustrations of working with files in PowerShell is that you can’t append to a pre-existing CSV file. Dmitry has fixed that for version 2 by creating a proxy function that adds that capability. http://dmitrysotnikov.wordpress.com/2010/01/19/export-csv-append/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+DmitrysPowerblog+%28Dmitry%27s+PowerBlog%29 Excellent Technorati Tags: … Continue reading

Posted in PowerShell V2 | Leave a comment

AD cmdlets qiuck reference

If you use the AD cmdlets that shipped with Windows 2008 R2 you will want to grab a copy of the quick reference guide that Jonathan has produced. http://www.jonathanmedd.net/2009/10/active-directory-powershell-quick-reference-guide.html Technorati Tags: PowerShell,Active Directory

Posted in PowerShell and Active Directory | Leave a comment

Advanced Warning – WMI & WQL

The UK PowerShell group will present a Live Meeting on PowerShell, WMI and WQL. Date: Tuesday 9th February 2009 Time: 7.30pm GMT Live Meeting details to follow Technorati Tags: PowerShell,User group

Posted in PowerShell User Group | Leave a comment

Regular Expressions

I have a bit of a love-hate relationship with regular expressions.  If like me they are not your absolute favourite things you will want to see the series of recent posts from James on the subject http://blogs.technet.com/jamesone/archive/2010/01/14/the-joy-of-reg-ex-part-1.aspx http://blogs.technet.com/jamesone/archive/2010/01/14/the-joy-of-reg-ex-part-2-ways-i-use-it.aspx http://blogs.technet.com/jamesone/archive/2010/01/16/the-joy-of-reg-ex-part-3-select-string.aspx Technorati … Continue reading

Posted in Powershell | Leave a comment

Getting Access table definitions

So far we have only created a single table but in a database with a number of tables we need to be able to view the table definitions. 001002003004005006007008009010011012013014015016 #### connect to database##$conn = New-Object -ComObject ADODB.Connection$mydb = "c:testtest03.mdb"$conn.Open("Provider = Microsoft.JET.OLEDB.4.0; Data Source = $mydb")$cat = New-Object -ComObject ADOX.Catalog$cat.ActiveConnection = $conn ## … Continue reading

Posted in PowerShell V2 | Leave a comment

Add-Computer

I was building some test machines yesterday and needed to add them to the domain. As they were Windows 2008 R2 with PowerShell v2 I decided to try Add-Computer. Add-Computer -DomainName mydomain -Credential mydomainmyaccount; restart-computer You will be prompted for … Continue reading

Posted in PowerShell V2 | Leave a comment

Hyper-V and Virtual PC

Just a quick warning – be careful if you have virtual machines in virtual PC and switch to using Hyper-V.  Not sure what I did wrong (it was late last night) but managed to trash my virtual SQL Server There … Continue reading

Posted in Windows Server 2008 | Leave a comment

Delete an index

We have seen how to add indexes. We also need to be able to remove them 001002003004005006007008009010011012013014015 function Remove-AccessIndex {# .ExternalHelp Maml-AccessFunctions.XML[CmdletBinding()]param (    [string]$table,    [string]$index,    [System.Data.OleDb.OleDbConnection]$connection)     $sql = "DROP INDEX $index ON $table"    Write-Debug $sql        $cmd = New-Object System.Data.OleDb.OleDbCommand($sql, $connection)    $cmd.ExecuteNonQuery()}   The function accepts connection plus table … Continue reading

Posted in PowerShell V2 | Leave a comment

UK User Group meeting

 First meeting of 2010 and we will be looking at Windows 2008 R2 cmdlets and provider.Physical meetings will resume later in the year    When: Tuesday, Jan 26, 2010 7:30 PM (GMT)Where: *~*~*~*~*~*~*~*~*~* Notes Richard Siddaway has invited you to attend an … Continue reading

Posted in PowerShell User Group | Leave a comment

Trouble with csv files

There are many situations where we want to read a csv file as part of our admin script – usually as a way to input data to the script for some kind of bulk processing. This makes the following a … Continue reading

Posted in Powershell | Leave a comment