Author Posts

March 14, 2017 at 3:33 pm

I have queried for installed hotfix information from a machine from windows client machine, im able to get all the information except the installed on file return with hexa decimal.
I imported the output file in to the excel sheet and tried to format the installed on column with normal date and time however i was unable to do it if i change the format the value appears like this "############".

Sample of output information from the get-hotfix information.
Caption Description HotFixID InstalledBy InstalledOn
http://support.microsoft.com/?kbid=2079403 Security Update KB2079403 S-1-5-21-1533859529-1408025176-2769211490-500 01ccdaac39926974 –> Date and time format.

Note : As per the design "https://msdn.microsoft.com/en-us/library/aa394391(VS.85).aspx" from some operating systems it is expected to get hexadecimal value

I have a powershell script which would gets me to open the excel sheet however im unable to write further commands to modify the installed on column to convert to date/time format from hexa decimal.

Any help would be higly appreaciated.

###############################################
Power shell script.
$oldci = [System.Threading.Thread]::CurrentThread.CurrentCulture
$newci = [System.Globalization.CultureInfo]"en-US"

$path='E:\Case share\HSBC-Manish\date.xlsx'
$objExcel = New-Object -ComObject "Excel.Application"
$objExcel.visible = $true
[system.threading.Thread]::CurrentThread.CurrentCulture = $newci
$objWorkbook =$objExcel.Workbooks.Open($path)
$worksheet = $objWorkbook.sheets.item("date")
#############################################

March 15, 2017 at 1:54 pm

Is this just that the column is too narrow in Excel, and you need to widen the column when viewing the sheet?

March 15, 2017 at 1:58 pm

And unfortunately, also per the docs, the only way I'm aware of to convert that is to use https://msdn.microsoft.com/en-us/library/ms724280(v=vs.85).aspx. However, unless you've got a REALLY REALLY OLD system, it shouldn't be using hex.

Additionally... are you hell-bent on using Excel? If so, you might look at Doug Finke's PowerShell commands for writing to Excel. Personally, I'd put the data in a SQL Express database. It's about a ton easier. We've a free book on building trend and historical reports that has several examples, including how to get SQL to generate reports from the data.