header image

Archive for March, 2009

Jonathan has a good write up about the next meeting – http://jonathanmedd.blogspot.com/2009/03/get-scripting-guys-take-over-march-uk.html Not sure that I‚Äôm looking forward to the Regular Expression session ūüôĀ ¬† Technorati Tags: PowerShell,User Group

under: PowerShell User Group

Folders for your files

Posted by: | March 13, 2009 | No Comment |

I had an interesting question, in an email, about creating a folder for each individual file type in a directory.¬† Based on the starting idea I ended up with this 001002003004005006007008009010011 $loc¬†=¬†"c:\test"Set-Location¬†-Path¬†$loc$extensions¬†=¬†Get-ChildItem¬†|¬†select¬†Extension¬†-Unique¬†|¬†foreach¬†{¬†¬†¬† $folder¬†=¬†$_.Extension.TrimStart(".")¬†¬†¬† if¬†(!(Test-Path¬†"$loc\$folder"))¬†{New-Item¬†-Path¬†$loc¬†-Name¬†$folder¬†-ItemType¬†Directory}¬†¬†¬† else¬†{Write-Host¬†"Folder $loc\$folder already exists"}}Get-ChildItem¬†|¬†Where{!$_.PSIsContainer}¬†|¬†foreach¬†{¬†¬†¬† $folder¬†=¬†$_.Extension.TrimStart(".")¬†¬†¬† Move-Item¬†$_¬† -Destination¬†$("$loc\$folder")} ¬† Get the unique extensions and pipe them into foreach. Remove the . at […]

under: PowerShell original

PowerShell in Newcastle

Posted by: | March 12, 2009 | No Comment |

Jonathan from the UK PowerShell UG is giving a PowerShell presentation on 24th March. Details from http://jonoble.spaces.live.com/blog/cns!CC73D8744F0894A5!1014.entry If you are in the area please support the event   Technorati Tags: PowerShell,IT Community,User Group

under: PowerShell User Group

Domain Controllers

Posted by: | March 11, 2009 | No Comment |

I found this part completed post & can‚Äôt remember if I ever published it.¬† If I did we‚Äôll put it down to my forgetfulness. The role of Domain Controllers in an Active Directory environment still seems to be causing problems nine years after the introduction of Windows 2000 and Active Directory. In an NT environment […]

under: Active Directory

Creating an object

Posted by: | March 11, 2009 | No Comment |

Jeffrey shows how to create custom objects – http://blogs.msdn.com/powershell/archive/2009/03/11/how-to-create-an-object-in-powershell.aspx I recently saw a demo by Jonathan Noble where he showed another way PS> $myobj = "" | Select Name, Price, DescriptionPS> $myobj.Name = "Test Object"PS> $myobj.Price = 27.88PS> $myobj.Description = "Some dodgy bit of stuff" Now we want to see what we have created PS> […]

under: PowerShell original

Half million

Posted by: | March 11, 2009 | No Comment |

This blog’s page view counter went through the half million mark over night.  Thank you to everyone who takes the time to read and comment.   Technorati Tags: PowerShell,IT Community

under: IT Community

One extra thing we can do with the troubleshooting packs is create answer files.¬† Start by loading the module and mapping the drive as before. Import-Module troubleshootingpack New-PSDrive -Name tspack -PSProvider FileSystem -Root "C:\Windows\diagnostics\system" -Description "Maps to the troubleshooting packs" We then run the pack to generate the answer files $unplug = Get-TroubleshootingPack -Path tspack:\Networking […]

under: Windows 7


Posted by: | March 8, 2009 | No Comment |

PowerShell v2 adds the Get-WinEvent cmdlet.¬† It can be used to access classic event logs and the new style introduced in Windows Vista\2008 One interesting parameter is the FilterHashTable.¬† We can set a hash table to filter the results rather than using where.¬† It is possible to filter on these items LogName=<String[]>ProviderName=<String[]>Path=<String[]>Keywords=<Long[]>ID=<Int32[]>Level=<Int32[]>StartTime=<DateTime>EndTime=<DataTime>UserID=<SID>Data=<String[]>*=<String[]> Some examples of […]

under: PowerShellV2

It looks like the IIS PowerShell provider is included with IIS in Windows 7.  The provider, and the associated cmdlets, make managing IIS much easier.   Technorati Tags: PowerShell,IIS,Windows 7

under: Windows 7


Posted by: | March 6, 2009 | No Comment |

I started thing about the troubleshooting packs we were looking at in the last post.¬† They are good but getting to them is a bit too hard.¬† We can short cut some of it by creating a PowerShell drive.¬† One of the great things about PowerShell is the provider system that exposes different data stores […]

under: PowerShell v2

« Newer Posts - Older Posts »