Monthly Archives: January 2011

COM pt 5–FileSystem Object

I haven’t finished with the WScript.Shell object and we will return to it.  This time I want to look at the FileSystem object. If you have worked with VBScript and files you will be familiar with this object.  While we … Continue reading

Posted in COM, PowerShell V2 | Leave a comment

COM pt 4

If you have been following along so far you may be thinking that you can use ls env: to view the environmental variables. True. But if you compare the output of part 3, the PowerShell enc: drive and getting the … Continue reading

Posted in COM, PowerShell V2 | Leave a comment

COM pt 3–More shell

Last time we looked at the Environment parameterized property If you ran the script in part two the output would have contained things like windir=%SystemRoot% We need to be able to resolve the variable %SystemRoot% part to the full path … Continue reading

Posted in COM, PowerShell V2 | Leave a comment

Reminder 1

Quick reminder that the UK PowerShell UG meeting for February is coming up soon. Details from here http://msmvps.com/blogs/richardsiddaway/archive/2011/01/18/uk-user-group-february-live-meeting.aspx   That reminds me – I’d better write the presentation 

Posted in PowerShell User Group, PowerShell V2 | Leave a comment

Science or Art

Infrastructure Architecture = Science or Art. Discuss. We claim the titles of architect and/or engineer but is what we do as infrastructure architects really based on solid scientific/engineering principles. I would claim not. Much of what we do is recycling … Continue reading

Posted in Architecture | Leave a comment

COM pt3–WScript.Shell

One thing that we seem to forget when we use PowerShell is the functionality that was available to us in VBScript through the Windows Scripting Host (WSH) objects. Much of this functionality has been duplicated in PowerShell cmdlets or through … Continue reading

Posted in COM, PowerShell V2, WSH | 1 Comment

Watching the file system

I picked up a question in the ITKE forums about a script to watch the file system   001002003004005006007008009010011012013014015016 function eventhandler {param ($e) Write-Host “File: $($e.SourceEventArgs.FullPath) has arrived”} $folder = “C:\test”$filter = “*”$fsw = New-Object -TypeName System.IO.FileSystemWatcher `-ArgumentList $folder, $filter$fsw.IncludeSubDirectories = $true $action = {eventhandler $($event)} Register-ObjectEvent -InputObject $fsw -EventName “Created” ` -SourceIdentifier “File System Creation” -Action $action   The event handler function accepts the event as a parameter and … Continue reading

Posted in Events, files, PowerShell V2 | Leave a comment