Archive for the ‘10’ Category

get-eventlog does not display time on out-file

Tuesday, November 26th, 2019

Powershell is fun and yet there are times it can be annoying.

I am doing a refresh as I am looking for a new job. My last one was not script minded.

A simply test was to get use get-eventlog sort by index and time. It did this. Next was to output index, time and source.

get-eventlog -logname Security -newest 50 |select-object -property index,time,source | sort time,index | out-file c:\last.txt

The other two worked. Time did not.

You would think it would be obvious to simply use “time” and well; it isn’t.

You need to use timegenerated or timewritten.

get-eventlog -logname Application -newest 50 |select-object -property index,timegenerated,source | sort index,time

More reading to do.

Advertisement

The return of python

Thursday, September 19th, 2019

I decided to take up python again. Wasn’t a heavy user as I was a bit of a Perl snob. The current job really doesn’t offer serious time for good scripting so I was a little lax on that front.

I have a refresher book “Visual Quickstart Guide for Python” and for simple minded fun “Mission Python: Code a space adventure Game”

The mission book wants pygame. I quickly found I needed to install pip as well. Commands not recognized.

I should mention; I am using Windows 10 on a laptop and have installed Visual Studio community edition with the Python add on. I still upgraded Python to the latest release.

If you are using Windows; you can make your python experience a little easier with two PATH additions for python and the scripts folder in python. In my case

  • “C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\”
  • “C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\ Scripts\”

After that; you can get a nice little script which will run the pip install. Start an admin level CMD window and enter: python <location of script>\get-pip.py

Once it’s installed; you can install pygame simply by entering: pip install pygame

It’s a quick install. Just verify there are no error messages.

Quick way to get license

Monday, April 15th, 2019

Every once in awhile I get the question of what license was installed on this windows vm?

A simple powershell way is to use:


powershell “(Get-WmiObject -query ‘select * from SoftwareLicensingService’).OA3xOriginalProductKey”

sshd service stopped, exist status 255

Friday, April 20th, 2018

I had one server with an sshd service which would terminate right after starting.

The event log would have the following error:

The description for Event ID 0 from source sshd cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.

If the event originated on another computer, the display information had to be saved with the event.

The following information was included with the event:

sshd: PID 9960: `sshd' service stopped, exit status: 255

Not too helpful of a message.

I decided to re-run the setup with an elevated Cygwin terminal.

ssh-host-config

*** Info: Generating missing SSH host keys
*** Query: Overwrite existing /etc/ssh_config file? (yes/no) yes
*** Info: Creating default /etc/ssh_config file
*** Query: Overwrite existing /etc/sshd_config file? (yes/no) yes
*** Info: Creating default /etc/sshd_config file

*** Info: StrictModes is set to 'yes' by default.
*** Info: This is the recommended setting, but it requires that the POSIX
*** Info: permissions of the user's home directory, the user's .ssh
*** Info: directory, and the user's ssh key files are tight so that
*** Info: only the user has write permissions.
*** Info: On the other hand, StrictModes don't work well with default
*** Info: Windows permissions of a home directory mounted with the
*** Info: 'noacl' option, and they don't work at all if the home
*** Info: directory is on a FAT or FAT32 partition.
*** Query: Should StrictModes be used? (yes/no) yes

*** Info: Privilege separation is set to 'sandbox' by default since
*** Info: OpenSSH 6.1. This is unsupported by Cygwin and has to be set
*** Info: to 'yes' or 'no'.
*** Info: However, using privilege separation requires a non-privileged account
*** Info: called 'sshd'.
*** Info: For more info on privilege separation read /usr/share/doc/openssh/README.privsep.
*** Query: Should privilege separation be used? (yes/no) yes
*** Info: Note that creating a new user requires that the current account have
*** Info: Administrator privileges. Should this script attempt to create a
*** Query: new local account 'sshd'? (yes/no) no
*** ERROR: Couldn't create user 'sshd'!
*** ERROR: Privilege separation set to 'no' again!
*** ERROR: Check your /etc/sshd_config file!
*** Info: Updating /etc/sshd_config file

*** Info: Sshd service is already installed.




*** Warning: Host configuration exited with 1 errors or warnings!
*** Warning: Make sure that all problems reported are fixed,
*** Warning: then re-run ssh-host-config.

After that.  The service stayed up.

Make sure you verify the access.  This particular server had sshd configured for one login and of course I didn’t have the password.

 

 

Office bit level

Wednesday, June 29th, 2016

I had a question about the bit level of Office 2016. Sometimes I try the different versions for testing and forgot what was last installed.

Outlook happened to be open so I clicked File and selected Office Account.

This brought up the Product information but it was not listed.

I clicked the Blue Question mark About Outlook Button.

There the level was listed and it turned out to be 32-bit.

Deleting the previous Windows 10 Install

Wednesday, March 9th, 2016

Windows 10 has been an adventure. I decided to “suffer for my art” and join the Windows 10 insider testing cycle. To add to my suffering I decided to join the fast cycle which meant more releases then normal.

If you are testing many things, you can run out of disk space and like most people there isn’t time to really go through and clean. What would be nice would be a fast recovery of space.

This is possible if you want to delete the previous install of Windows 10. On average, it was about 10 gig for me.

If you are happy with the current install and will not roll back to the previous release, you can delete the previous install.

Search for Settings and open it.

  • Click on System
  • Click Storage
  • Click “This PC (C:)
  • Scroll down and Click “Temporary Files

Here you will see your Temporary file usage and at the bottom of the list is “Previous version of Windows

Simple click “Delete previous versions” and start the process.

You can do other things while the cleanup runs.

As mentioned this is useful if you need space and don’t have time to do a proper cleanup. Don’t forget to look at your downloads.  People forget to check that all the time.  I had 27 gig  *coughs*

 

Win10 build 14251 breaks jabber

Thursday, February 4th, 2016

I am on the preview testing cycle for Windows 10. Why? I like to be tortured I guess. Originally, it was to get an early view of the OS through the Windows Insider Program.

At one point I installed the released version but the program overlaid my full OS with another build of the Preview releases. You have to cancel the program to prevent this.

I received build 14251 as part of the normal sequence but I found this release broke jabber. The text was invisible. Secret Agent Man Font? I verified many things were in place (an old one is active scripting disabled for IE). But nothing readily obvious.

A few days later 14257 was released and jabber worked again.

No remote server administration toolkit for Windows 10?

Friday, August 7th, 2015

RSAT is one of those “must haves” for server management and scripting.  It just makes work easier.

I early tested Windows 10 and there was a great deal of complaining when the preview release of RSAT stopped working.  I even expressed concern over this and promptly reserved a survey about what I thought of the new look.  They probably just “rolled their eyes” when I responded with I don’t care about “eye candy” when RSAT doesn’t work.

Microsoft’s response was it would be a couple weeks after RTM.  Sounds hopeful but they tend to align RSAT with the server release.

Will this be the case or does a couple of weeks in Microsoft speak mean next year?

Rather annoying and it does give thought to downgrading back to Windows 8.

-edit-

RSAT was released with the preview of 2016. Things are right in the Powershell universe again.

Windows 10 Preview won’t activate!

Friday, June 5th, 2015

I am early testing windows 10.  Overall I am liking the OS but it has it quirks and issues. My biggest issue involved the Juniper Pulse client no longer functioning.

I recently upgraded to release 100130 and found the pulse client not working and the OS required activation.

The product key had changed and the new one would not take. The error basically said the wrong product key is in play?

I tried many things and nothing worked. Then, I remembered I was testing the Enterprise version.

A quick check of the site and sure enough there was a different product key.  I used it and the OS activated.

The pulse client decided to be a pain again. It would take the token and then sit forever with a message about securing the tunnel.

I installed the latest build of but the problem remained.  I removed and installed the client and this time it was able to connect!