Powershell Retrieving Remote System Time

Compare Local Date and Time to a Remote Computer

This is a rather interesting problem. I was doing a comparison between an audit table and a trace for SQL Server, which was proving to be dificult as I soon realized there was latency as well as the system date’s had an offset. So I turned to my good old friend, Powershell. Powershell has a very nice interface for coding against WMI, which I fully leveraged in this code snippet.

#Server name here. 
$ServerName = <Server Name Here>
#Retreive the localtime of the server. 
$remoteDate = Get-WmiObject -ComputerName $ServerName -Class win32_operatingsystem -Property LocalDateTime
#Converting a WMI time to a standard datetime format. 
$remoteDate = [System.Management.ManagementDateTimeConverter]::ToDateTime($remoteDate.LocalDateTime)

$localDate = Get-Date

#Displaying the difference. 
$remoteDate - $localDate

MS Access Upsizing to SQL Server Issues & Troubleshooting

Upsizing Access Databases to SQL Server?

If you are like me you have had one or two very small Access databases that have grown and need SQL Server’s power. Naturally you run the upsizing wizard and move over all your tables. This allows you to keep the Access fron-end and have a rip-roaring SQL Server in the back-end. Here are a couple things to look out for:

Careful with the Switchboard

Migrating the switchboard table over to SQL Server is a good idea if you want have many people using the Access database front-end.  If you can figure out the switchboard table, you can modify your switchboard using this table.

If you migrate the switchboard table to SQL Server, you can no longer use the Switchboard Manager

To get around this issue, you have have to modify the table directly.

Timestamps: Problems Updating Data

Be sure that you include a timestamp on your tables, Access needs these if it is going to make some DML changes to your data. I believe although couldn’t find verification that it uses timestamps on the tables as a locking mechanism and reduces contention.

New Problem, Indexes

Primary keys do not come over appropriately. They come over as unique non-clustered indexes, not clustered. This means your data can be stored out of order on disk, which is very inefficient for larger tables. Delete these indexes and create primary keys for them!

Lastly, any changes made to indexes (creating, altering, dropping) will need the Access front end to be updated. Be sure to refresh your linked tables in the linked table manager.