Last accessed time of a file

Posted on February 12th, 2009 in Powershell by admin

This example displays the last time notepad and explorer were accessed

$file = Dir c:\windows\explorer.exe
$file.LastAccessTime
$file = Dir c:\windows\notepad.exe
$file.LastAccessTime

Open internet explorer and display a webpage using powershell

Posted on February 12th, 2009 in Powershell by admin

Open internet explorer and display a webpage, in this case this site

$ie = new-object -comobject “InternetExplorer.Application”
$ie.visible = $true
$ie.navigate(”tutorials.programmingsite.co.uk”)

Display current time

Posted on February 12th, 2009 in Powershell by admin

Display current time using powershell

$strComputer = “.”
$colItems = get-wmiobject -class “Win32_LocalTime” -namespace “root\CIMV2″ `
-computername $strComputer
foreach ($objItem in $colItems)
{
write-host $objItem.Hour”:”$objItem.Minute”:”$objItem.Second
write-host
}