About Me

My photo
Bergen, Norway
19th times Microsoft MVP (Security and Windows). IT-Dude @SpareBankenNorge
Showing posts with label cmd. Show all posts
Showing posts with label cmd. Show all posts

Tuesday, April 11, 2017

When was Windows started?

How long have the Server of PC been running? Sometimes you need to figure when the OS was started. As always there are different was of getting this information. Some ways are quick and easy when you are sitting with the OS GUI in front of you, but other times you might want to use it in a script or get it from the command line. Here are a selection of methods I use.

GUI

You can checkout network adapter duration, but you will easier find the "Task Manager - Performance - Up Time"

Friday, March 31, 2017

When was Windows installed?

For different reason, you might want to know when Windows installed.
Luckily you can find this information other places then checking out the date on certain system files that was created/modified and stamped at the same time as when you installed Windows. The file date stamp method does not in calculate that files change this information during upgrades etc. during the lifecycle of the installation 

In registry, you have a Key to help you with this information.
HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\InstallDate


A Safer Way Of Running Unsigned Powershell Scripts

There is no doubt that as a company you should have setup a way of signing all the PowerShell script you are intending to run in your production environment.
But as we all known there will be situation where you want to run unsigned code, or maybe you are testing things out before you are ready to sign them.

Wednesday, April 22, 2015

Check if your script are running in administrator context

Doing system changes via a script files will often require that you run it in the context of administrator.

Doing this with script I run myself is easy enough, I know that if it fails it is because I forgot to use "Run as administrator" when I started it (or did a poor job creating the script).
However when creating scripts that other people will run it will be a good idea to add a check in the script and give feedback to the person running it.

Cleaning Up Unknown IAM Assignments Across Azure Subscriptions

  If you manage more than a handful of Azure subscriptions, IAM hygiene quickly becomes one of those tasks everyone knows is important, but ...