Wednesday, 22 January 2014

Disk Usage Information

Program to get Disk usage information 

Use the below script to find the disk usage on windows. This script would be helpful when you want to work on disk utilization tasks such as cleanup process on  disks, Auditing purpose etc,.

Use this script to check the limit of disk utilization. And use Send-Mailmessage to send the alert to the specific person and schedule the script on task scheduler.

function get-DiskUsage {

Get-ChildItem -Recurse -Directory | Select-Object FullName,
@{ Name="Size";
Expression={ ($_ | Get-ChildItem |
Measure-Object -Sum Length).Sum + 0 } }

Thursday, 9 January 2014

Make your Computer to speak with Powershell

Use the COM object to make the computer to speak. We could intimate the administrator using this computer speaking feature using powershell when they receive an error. This would be helpful to the scripting developer.

Use the New-Object cmdlet to create the COM object as mentioned in the below screenshot.

.Net Static Method

How to list the static method using Get-Member cmdlet?

Once you know the .net type, we can list the static method using the Get-Member.


[Sytem.Guid] -> .Net Type

Newguid() -> .Net Method

Have look at the below screenshot.

If you are in a situation to fetch the local machine timezone, you can use the method as mentioned in the below screenshot.