I responded to a comment about querying remote event logs using WMI. The issue is performance, especially when filtering. The commenter was using code like this: $d=get-date$BeginDate=[System.Management.ManagementDateTimeConverter]::ToDMTFDateTime($d.AddDays(-7)) $B = get-wmiobject –class win32_ntlogevent –computerName $FQDNservername -credential $Credentials | Where-object { $_.logfile -eq “system” -and ($_.eventcode –eq “20048” -and $_.TimeWritten -ge $BeginDate) } | select-object Logfile,EventCode,TimeGenerated,TimeWritten,Message I […]
Category: Windows PowerShell
PSCX – Get-ADObject
I’ve started looking at the latest version of the PowerShell Community Extensions. One cmdlet that is sure to be popular is Get-ADobject. Get-ADObject [-Class] [-Credential] [-DistinguishedName] [-Domain] [-Filter] [-GlobalCatalog] [-Scope] [-Server] [-Value] [<CommonParameters>] I’ve just started exploring its capabilities. But it makes getting objects from Active Directory a snap. This command returns a variable, $users, […]
Purge Recycle Bin
The other day I showed how to find out how much space was being used by the recycle bin. To clear the folder you can use an expression that takes the result of Get-Child-item and pipes it to Remove-Item.
Fast & Furious PowerShell: Get Recycle Size
Here’s a fast & furious tip on using PowerShell to find out how much is in the Recycle bin. All you should need to do is use Get-ChildItem to enumerate the Recycle folder. By default it is hidden so you need to use the -Force parameter. To get the total size of all the files, simply run this…
Fast & Furious PowerShell: Find that Function
Like my recent post about the Alias provider. There is also a Function provider. You can use basically the same techniques that I used to explore aliases.
dir function:
Fast & Furious PowerShell: Unmask the alias
I’ve started using a lot of aliases in my PowerShell work. Many of them defined in my PowerShell profile. Unfortunately, I don’t always remember what I’ve defined, or even what the alias sometimes stands for. But with a few fast & furious PowerShell expressions, I can strip away the mystery.
Windows PowerShell Self-Paced Training
SAPIEN Technologies announces their new Windows PowerShell self-paced training bundle. This bundle includes the book Windows PowerShell: TFM, and the new “Windows PowerShell 101” self-paced “class-on-disc” title by Don Jones. The disc consists of lecture, conceptual animations, hands-on exercises, narrated demonstrations, self-assessment quizzes, and more, and includes bonus self-paced training for general WMI and ADSI […]
Managing Exchange 2003 Servers with PowerShell
We all know that PowerShell and Exchange 2007 were made for one another. However, that doesn’t mean you can’t use PowerShell to manage Exchange 2003 servers. I’m not saying you can get all the functionality that you do with Exchange 2007, but you’re not totally left out either. Exchange 2003 added many WMI classes and the Get-WMIObject cmdlet is perfect for getting information from Exchange 2003. In fact, because of pipelining, it is even easier to get information properly formatted than it is using VBScript.
Updated PowerShell Help Tool Now Available
SAPIEN Technologies has released a new version of their free PowerShell tool. This tool gets all the help information from your PowerShell installation and presents it in a nice GUI. Not only will you get alias and cmdlet help for the core PowerShell stuff, but also any installed snapins such as Power Gadgets, PrimalToys and PowerShell Community Extensions. As long as there is a registered PowerShell help file associated with a snapin, it should be detected and loaded into PowerShell Help.
More Fast & Furious: Remote Event Logs
The other day, I demonstrated a fast &furious way to check eventlogs on the local computer. Unfortunately the Get-Eventlog cmdlet doesn’t have a remote computer option. To get event logs from remote computers, you need to use Get-WMIObject. Unfortunately,this requires a bit more work.