Sometimes curious about this, usually because I forgot to note what time I arrived at the office, and I keep forgetting how to check. So, here’s some commands I found on SuperUser which seem to do the trick:
> systeminfo | find /i "Boot Time"
System Boot Time: 15.10.2021, 08:37:29
> wmic os get lastbootuptime
> net statistics workstation | find /i "Statistics since"
Statistics since 15.10.2021 08:37:45
Also discovered this one, which will create a more thorough report, which can be interesting to look at:
> powercfg /sleepstudy /output report.html && start report.html
I have an Excel sheet where I not down the time I arrive at work and the time I leave. It tends to vary a bit, and on a regular basis I forget noting down the time I arrived. At my previous job I used a simple tool called TurnedOnTimesView for this, but because the laptops here are managed differently, it isn’t as reliable as it was. So, I figured I could try to enter the scary world of the Event Viewer.
In the Event Viewer you can create custom filtered views, and I first thought it would be as simple as looking for “Logon” events… but that filter gave me a mountain of logon events, most of which seemed to be various system events, and even IWA events from browsers logging on to company websites. Basically, there was a lot of noise.
Eventually though, digging out some old XPath skills, and identifying some key identifiers (EventID=4648 and ProcessName=lsass), I managed to come up with a query that actually seem to be quite accurate:
<Query Id="0" Path="Security">
(TimeCreated[timediff(@SystemTime) <= 604800000]) and
(Data[@Name='ProcessName'] = 'C:\Windows\System32\lsass.exe') and
(Data[@Name='TargetDomainName'] = 'YOUR DOMAIN') and
(Data[@Name='TargetUserName'] = 'YOUR USERNAME')
This, unless I have misunderstood something, should list all actual login events, by you, within the last week. I.e. not various services, HTTP stuff, etc., etc.
There’s a command-line tool called certutil one can use to add (among other things) certificates to the certificate store in windows.
REM Add pfx-file to Personal
certutil -ent -p pfxpassword -importpfx my some.pfx
REM Add pfx-file to Trusted Root Certification Authorities
certutil -ent -p pfxpassword -importpfx root some.pfx
REM Add cer-file to Trusted Root Certification Authorities
certutil -ent -addstore root some.cer
- Win + r
Logged into a windows share via explorer and hit the Remember Password option. Even though the login was accepted (and saved) it turned out I had used the wrong ad domain name…
Couldn’t find where to reset/change/”logout” again, but eventually found there’s a built-in command-line tool one can use for managing these saved passwords. Think I’ve seen a control panel type thing to do this too in the past, but just couldn’t find it today… Anyways, command-line is nice, so, using imaginary share \\foobar.int, here’s some stuff one can do:
> cmdkey /list
> cmdkey /list:foobar.int
> cmdkey /delete:foobar.int
> cmdkey /add:foobar.int /user:domain\username /pass
Trying to set up Apache on a server, something is hogging port 80, but very “helpfully” the Resource Monitor just reports “System” with PID 4…
However, some commands found in a StackOverflow answer and its comments were helpful:
netsh http show urlacl
netsh http show servicestate
net stop http
Note: Do not just run these commands blindly and turn off services (in particular you should probably answer N when the last one asks…), but use them to identify what service(s) might be to blame. Then do an intelligent decision on whether the service is needed or not, before you potentially stop it and disable it…
Couldn’t get this to work, but now it does, so… time for another “note to self”. ðŸ™‚
- Git, obviously…
- PuTTY, with puttygen, plink and pageant, to be exact…
Either Load an existing private key, or Generate a new one.
Copy the public key (“Public key for pasting …”) and add it to the git provider settings:
Load your private key.
Check that the key authentication works with plink:
plink -v firstname.lastname@example.org
plink -v email@example.com
plink -v firstname.lastname@example.org
Set the GIT_SSH environment variable to C:\Program Files\PuTTY\plink.exe.
^^ This is the detail that so many StackOverflow answers and blog/forum posts didn’t mention. Without this, plink worked fine, but git commands still failed with authentication errors.
(optional) Add a shortcut to the private key file to your startup folder. This way pageant will be automatically started, with your key, ready to go, whenever Windows boots up.
Now, as long as pageant is running with your private key loaded, it should work to clone, pull, push, etc., both to and from, both private and public git repositories. E.g. like this:
git clone email@example.com:example/some-private-repo.git
Note: If you’re asked to accept/store/cache a key, but pressing y doesn’t work, connect using putty first, which should give you a dialog with the same question which does work. Putty will complain/crash because there’s not actually an ssh shell to connect to, but that’s fine. After the key has been saved by putty, git should work fine. E.g. like this:
putty -ssh firstname.lastname@example.org
Sources: makandracards.com, vladmihalcea.com