Share the Knowledge
RSS icon Home icon
  • How to convert a Large Integer value to normal date format using PowerShell

    Posted on December 6th, 2010 webmaster No comments         Print Print

    My co-worker was wondering last week whether an old Windows domain user account was still being used by someone.  Having managed Windows domain environments at my previous jobs, the first thing I did of course was go to Active Directory and check the LastLogonTimestamp attribute.  This attribute is stored in the Active Directory database as a Large Integer so it will need to be converted to a normal date format to make sense of it.

    The following PowerShell command can be used to do the conversion (forgot the website where I got this from, will reference it here if I find it again):

    
    $lastLogonTimestamp = "129358017032999046"
    
    [DateTime]::FromFiletime([Int64]::Parse($lastLogonTimestamp))
    

  • How to automate Microsoft Office 2007 installation

    Posted on March 11th, 2009 webmaster 9 comments         Print Print

    I was just updating some documentation on our wiki and found some old notes on automating Office 2007 installation.  We upgraded our Microsoft Office software early last year from Office 2003 (and a few Office XP) to Office 2007 and this simple installation script saved us a lot of time. Here are the steps:

    Step 1.  Copy the contents of the Office 2007 installation CD (or package) to a network share (eg. \\server\Office12).

    Step 2.  Run the Office Customization Tool and create a setup customization file (I got these instructions from a BDD 2007 document on Microsoft’s website).

    Read the rest of this entry »

  • Useful PowerShell Scripts

    Posted on January 2nd, 2008 webmaster No comments         Print Print

    Below are some simple PowerShell scripts that I find pretty useful in Windows administration:

    Note: For the scripts that connect to a remote machine, you will need to run PowerShell as a user with Administrator privileges to that machine.

    Aliases:

    • Gwmi = Get-WmiObject
    • fl = Format-List
    • ft = Fomat-Table
    • -Comp = -ComputerName

    Get a list of installed applications for a specified machine (32-bit OS only).
    Gwmi Win32_Product -Comp computer_name | Sort name | ft name, version, installdate

    Get the Service Tag (Dell computers) and BIOS version for a specified machine.
    Gwmi Win32_BIOS -Comp computer_name

    Get the computer information for a specified machine (Domain, Manufacturer, Model, Name, Owner, Memory).
    Gwmi Win32_ComputerSystem -Comp computer_name | fl

    Get storage drive information for a specified machine (Hard Drive, Floppy, CD/DVD-ROM).
    Gwmi Win32_LogicalDisk -Comp computer_name | fl

    Get the logged on user name for a specified machine.
    Gwmi Win32_Computersystem -Comp computer_name | Select Name, UserName

    Get the running processes for a specified machine.
    Gwmi Win32_Process -ComputerName computer_name | Sort processname | ft processname, ws, executablepath