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 have techniques in PowerShell to perform many of the same tasks there are still a […]
Archive for January, 2011
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 environmental variables via WMI you will find that they aren’t identical. The point of this […]
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 001 002 003 004 005 006 007 008 009 010 011 012 013 014 $wshell = New-Object -ComObject "WScript.Shell" […]
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
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 the designs of the past – possibly adapting them as new versions of particular technologies […]
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 .NET classes but there is still a good pile of stuff we can use. I […]
I picked up a question in the ITKE forums about a script to watch the file system 001 002 003 004 005 006 007 008 009 010 011 012 013 014 015 016 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 […]
$shell = New-Object -ComObject "Shell.Application" gets us a shell object. We can then see the methods available to us PS> $shell | gm -MemberType method | Format-Wide -Column 2 AddToRecent BrowseForFolder CanStartStopService CascadeWindows ControlPanelItem EjectPC Explore ExplorerPolicy FileRun FindComputer FindFiles FindPrinter GetSetting GetSystemInformation Help IsRestricted IsServiceRunning MinimizeAll NameSpace Open RefreshMenu ServiceStart ServiceStop SetTime ShellExecute […]
In April I will be doing a User Group Live Meeting on using COM with PowerShell. It is such a wide topic I thought I’d start a few posts to set some background – it also helps my reasearch COM is the way applications were built for the Windows platform before .NET appeared. Ugh pre-historic […]
I’ve just started a series on using the WMI system restore classes to work with remote machines at http://itknowledgeexchange.techtarget.com/powershell/ The functions developed in this series will become the next PSAM module
Categories
- .NET
- Active Directory
- Architecture
- Azure
- Bash
- BITS
- Books
- CDXML
- CIM
- Cloud
- COM
- Containers
- Deep Dive
- Desired State Configuration
- DevOps
- DHCP
- DNS
- DSC
- European Summit
- Events
- Exchange
- File System
- Firewall
- General
- General IT Matters
- Hyper-V
- IIS
- Infrastructure
- IT Community
- IT Security
- Learning PowerShell
- Linux
- Math
- Microsoft
- Modules
- Nano Server
- Networking
- Office 2010
- Office 2013
- Open Source
- Opinion
- Outlook
- Philosophy
- PowerShell
- PowerShell 7
- PowerShell and .NET
- PowerShell and Active Directory
- PowerShell and CIM
- PowerShell and Exchange 2007
- PowerShell and IIS
- PowerShell and SQL Server
- PowerShell and WMI
- PowerShell Basics
- PowerShell original
- PowerShell Summit
- PowerShell User Group
- PowerShell User Group 2
- PowerShell v2
- PowerShell V3
- PowerShell v4
- PowerShell v5
- PowerShell v6
- PowerShell.org
- PowerShellGet
- PowerShellV2
- PSAM
- Rant
- Registry
- Scripting
- Scripting Games
- Scripting Games 2104
- Security
- SQL Server
- Storage
- Strings
- Summit
- Technology
- Uncategorized
- Virtualization
- Windows 10
- Windows 2012 R2
- Windows 7
- Windows 8
- Windows 8 Server
- Windows 8.1
- Windows Server
- Windows server 1709
- Windows Server 2008
- Windows Server 2008 R2
- Windows Server 2012
- Windows Server 2012 R2
- Windows Server 2016
- Windows Server 2019
- WMFv5
- WPF
- WSUS