Showing posts with label Windows. Show all posts
Showing posts with label Windows. Show all posts

Saturday, October 24, 2015

Recusivly finding files by extension in DOS

Need to find all files of a specific extension in DOS.  Here is a command that will recursively look through a directory structure and list only those files with that exact extension:
dir /s/b *.mp3 | findstr /v .mp3.

Tuesday, September 15, 2015

RDP and autologin - disconnect every 2 minutes

I discovered something that annoying about RDP... I was getting dropped from RDP every 2 minutes.  After looking around, I discovered some information that it was related to the fact that autologon was configured on the remote machine.

In essence, as I understand it, after 2 minutes Windows would attempt to ensure that the default user was logged in.  For some reason this forces the RDP to get logged out (check the event viewer).

SOLUTION: disable autologon.

ANOTHER SOLUTION:  This seemed to work.  Delete the key:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsNT\CurrentVersion\Winlogon\ForceAutoLogon

Friday, January 9, 2015

Clear All Windows 2008 R2 event logs

If you want to clear the event logs in a Windows Server system, you can fire up Event Viewer, browse to the desired log and from the Actions menu select Clear Log.... But if you want to clear all the System and Application logs at once, you'd better use the `wevtutil' command line utility Microsoft offers. A Windows PowerShell command like this will do the job: 


wevtutil el | foreach { wevtutil cl $_ }

(from http://skalkoto.blogspot.com/2011/08/clear-all-windows-2008-r2-event-logs.html)


Monday, September 22, 2014

Windows Explorer history - how to modify the Previous Locations pulldown

I've gotten frustrated that I can not control the list of entries in the "Previous Locations" pulldown in Windows Explorer.  Finally figured out how...

Using regedit, edit the following location:

HKEY_CURRENT_USER\Software\Microsoft\Windows\Current Version\Explorer\TypedPaths

Modify the value of the entries in that folder accordingly.

Friday, May 30, 2014

BGinfo display only active IP address

One of the pains of using BGinfo is that it lists too many non functional IP addresses.  To solve this (partly), this post talks about using a custom entry:

http://www.renjithmenon.com/how-to-set-bginfo-to-display-only-the-active-network-cards-ip-address/

This, for me, is only a partial solution as I want to show only the active network card information for things like the DNS, Subnet etc.  To do this, I created custom fields in BGinfo and (sort of replaced) the existing fields.

Here are the details:

I clicked Custom > New > WMI Query > Browse.  For the Identified (name) I use the same name as exists, but I do 2 things differently so that I don't overwrite the existing BGinfo entry.  First, I use 2 spaces in the name.  This means the identifier looks the same, but doesn't replace it. So now, in the list of fields, it appears as though there are 2 IP Address entries.  The seocnd thing I do so that I can tell the different in I use a lower case letter for the second word.  Therefore, I have an "IP Address" entry and a "IP  address".  The now look very similar, but I can tell the difference.

At this point, you can build the necessary query string using the interface to (first) select the right WMI Class (Win32_NetworkAdapterConfiguration) and (second) select the Class Property (for example IPAddress).  At this point, click Evaluate to see the list (since there are multiple IP addresses).

Next, limit the list using the WHERE clause.  For example, in my case the only IP addresses I want happen to be both active as well as have DHCP enabled.  So I use:


SELECT IPAddress FROM Win32_NetworkAdapterConfiguration Where IPEnabled=True and DHCPEnabled=True

For me, this returns just the IP address I'm interested in.  I replace the "IP Address" entry in BGinfo with my "IP  address" entry.

I create the following custom entries:


  • DNS  server - SELECT DNSServerSearchOrder FROM Win32_NetworkAdapterConfiguration Where IPEnabled=True and DHCPEnabled=True
  • IP  address - SELECT IPAddress FROM Win32_NetworkAdapterConfiguration Where IPEnabled=True and DHCPEnabled=True
  • Network  card - SELECT Description FROM Win32_NetworkAdapterConfiguration Where IPEnabled=True and DHCPEnabled=True
  • Subnet  mask - SELECT IPSubnet FROM Win32_NetworkAdapterConfiguration Where IPEnabled=True and DHCPEnabled=True
Here is the end result:




Here is the bgi file that was saved: https://drive.google.com/file/d/0B35FDpn8GEl0RFhTZExIdjlRQm8/edit?usp=sharing



Wednesday, May 21, 2014

Lenovo W530 - webcam doesn't work

The webcam keeps disappearing from the OS and from Skype.  It comes up with a message saying that the camera is in use by another application.

I've read a number of posts in the various Lenovo forums, and they indicate that lots of others are having similar issues.  Typically I'm able to fix this by going into Fn-F6 and tweaking something in there... but that is no longer working for me (the dialog no longer comes up).

So:

- to manually bring up that dialog, instead us Start > Lenovo - Web Conferencing or Start > Communications.

(still testing these to see if they help)

- Set the privacy to Normal

- Disable Activate Camera Plus (under Detailed settings)

Saturday, May 17, 2014

Windows custom hotkeys / shortcut keys

Trying to create hotkeys for things within Windows 7.  According to the docs, it seems as though you should be able to create a shortcut to the executable and add shortcut keys.  Not so much...

This seems to work OK when you have your shortcut on the desktop.  But, if that shortcut is moved of just created in another location, no such luck... the shortcut keys no longer work.

I found the post below which provides a suggestion, an explanation and some discussion.  In short:


Create a folder called:
C:\Users\username\AppData\Roaming\Microsoft\Windows\Start Menu\_hotkeys
Hotkey assignments within shortcuts in there are remembered/restored at next login.
http://www.sevenforums.com/customization/34091-custom-keyboard-shortcut-key-not-working-properly-2.html

Friday, April 11, 2014

XP activation key warnings issue - solution

The DETAILS:

- rename C:\WINDOWS\system32\WgaLogon.dll    to C:\WINDOWS\system32\_WgaLogon.dll  (or anything)

- rename C:\WINDOWS\system32\WgaTray.exe   to     C:\WINDOWS\system32\_WgaTray.exe  (or anything)

- reboot

Thursday, February 6, 2014

Headphone volume gets reduced

On occasion, I find that the volume on my USB headphones gets reduced... I can not get them to go to the real max volume.  

A number of things can cause this, but one fix that I've used is the following:

  • Go to the Sounds interface
  • Select the sound device in question and click Properties 
  • On the Levels tab, set level to 100%
  • On the Enhancements tab, enable Loudness Equalization
  • Click Apply
That sound increase (at least in some cases) the max volume of your device.

Saturday, August 10, 2013

Remote restart of a windows machine

ssh <user>@<host>

# restart with a force
shutdown -r -f  0

# possibly -t 0 instead of just 0

# show all and Windows process
ps -aW 

# kill the winlogon process ???
/bin/kill -f <pid>

Friday, August 2, 2013

Securing FTP (ftpes) using filezilla (client & server)

Using standard FTP is generally speaking a really bad idea from a security perspective.  The issue, among other things, is that the userid and password are sent over the network in clear text.  This means anyone sniffing the network now has complete access to your account.

To solve this, use either sftp or ftps.  Both use SSL to help secure the connection.  There are arguments for either sftp or ftps, but I will describe setting up ftps because it is rather simple and easy to install/configure.

This setup uses both the filezilla server and the filezilla client.  Part 1 describe configuring the ftpd (the server or daemon).  Part 2 describes how to set up the client.

Part 1: the server

Configure the server for SSL support:
  1. Download and install the filezilla server.  Use google to find the download site.
    1. You will probably want to set this up to "Install as a service, start with Windows"
  2. Bring up the Filezilla Server, and open Edit > Setting
  3. Under General settings, choose a non-default port (adds security): 2121
  4. Under General settings > Welcome message, alter the welcome message as you desire.  This is the message that is displayed to the incoming client requests.
  5. Under Passive mode settings:
    • Select "Use custom port range" and enter a range (for example 54054 - 54084)
    • Select "Use the following IP" and enter your hostname 
      • This should be your external hostname assuming you are using DDNS
      • You then need to configure port forwarding for the port you previously specified [2121] and the port range to this host's local IP address
  6. Under SSL/TLS settings, select "Enable FTP over SSL/TLS support (FTPS) and click "Generate new certificate..."
    1. In the dialog box, enter "US" for the country code
    2. Click Browse next to Save key and certificate to this file".  Browse to "C:\Program Files (x86)\FileZilla Server" and click Save.  Click "Gernerate certificate".
    3.  Fill in whatever other fields you wish
    4.  and click "Generate certificate"
    5. Back on the SSL/TLS settings screen, select both "Allow explicit FTP over TLS" and "Disallow plain unencrypted FTP"
  7. Click OK
  8. Restart the server
Configure the filewall.  If you have a filewall running on the server machine, you will need to create the appropriate rules to allow your ports in.  Those steps will depend on the specific firewall software being used.

Assuming the Windows firewall on Windows 7, here are the steps I followed:

  1. Start -> Windows Firewall with Advanced Security
  2. Inbound Rules
  3. New Rule...
  4. Select Port, click Next
  5. Select Specific local ports" and enter "2121, 54054-54084"  (matching the ports for the server above).  Click Next
  6. Select "Allow the connection", click Next
  7. Select all options for "When does this rule apply" and click Next
  8. Provide a name (for example ftpes), click Finish


Create your user account (at least one account):

  1. Edit > Settings > Users
  2. Click Add to create the user
  3. Enter a username and click OK
  4. Select the Password checkbox and enter a password
  5. Check "Force SSL for user login"
  6. Click Shared folders on the left
  7. Click Add to create the home directory and browse to the location you want to assign as the users home directory.  Click OK
    • Add any aliases to point at other disks or directories as needed
  8. Select the user permission (leave the default settings for read-only access or select all for read/write access)
  9. Click OK


Part 2: the client

Install the filezilla client
  1. Download and install the filezilla client.  Use google to find the download site.
  2. Run the install and accept all the defaults
Connect from the client to the server over SSL
  1. Start the filezilla client
  2. Enter ftpes::/<hostname or ipaddress> into the Host field
  3. Enter the username and passwords
  4. Enter the port you defined in the server in the port field
  5. Press enter

Wednesday, July 31, 2013

Checking what memory your system has

Use the web site www.crucial.com.  Click on the memory tab and run their memory tool.  This shows the number of slots and what memory they have in them.

Tuesday, May 28, 2013

Installing cygwin - which packages I choose

Every time I install cygwin, I struggle to remember which packages I select.  So here is that start of a list (which will get updated over time):


  • emacs
  • ssh
  • ssl
  • xdmcp
  • wget
  • bash
  • ncurses
  • inetutils
  • rsync
  • curl

Cygwin - setting up sshd as service

The following article goes through the process of setting up cygwin's sshd as a service:


How To Get SSH Command-Line Access to Windows 7 Using Cygwin
http://www.howtogeek.com/howto/41560/how-to-get-ssh-command-line-access-to-windows-7-using-cygwin/
The short version:

  • Install cygwin - include ssh
  • Run terminal (as administrator)
  • run ssh-host-config and go through questions
  • Start service (either reboot or "net start sshd")
To uninstall the service, use the rollowing command:


cygrunsrv -R sshd
-------------------

Some additional notes for setting up on XP:
http://mugurel.sumanariu.ro/linux/steps-to-setting-up-cygwin-and-the-sshd-service-for-windows-xp/ 
Setting up client access to use keys instead of passwords:
http://www.teachmejoomla.net/code/misc/authentication-without-password-with-ssh-and-rsync.html 

Sunday, May 26, 2013

Gmail - creating your own specific address

Want to send something to your gmail account and make it specific to a vendor?  Do the following... give them the address:

    <your-address>+<specific-marker>@gmail.com

For example:

    pete+starbucks@gmail.com

The email will be delivered to your regular gmail account and the to address will display the whole address (including the marker).

Wednesday, May 22, 2013

Windows 7 Activation Error (0x8007232B)


If you get the error 0x8007232B when you try to activate Windows 7, then you need to run these commands: 
slmgr.vbs -ipk [your product key]

slmgr.vbs -ato

Friday, May 17, 2013

Setting up a windows service... run anything as a service

There is a freeware solution to setting things up as a service that seems to work better (in more cases) than traditional approaches.

    http://www.serviceex.com/


ServiceEx is a freeware Windows application that allows a normal program to run as a Windows service. Currently it is command line only. A version with a GUI is forthcoming. In the meantime, configuration options are specified via an .ini file that must be created prior to running ServiceEx.

ServiceEx differs from Microsoft's srvany in that it monitors the program and relaunches it whenever it shuts down for any reason. If you do not wish to have this behavior, you can turn it off. A link to download it is provided below.

Sample .ini file:

[ServiceEx] 
ServiceExeFullPath = "C:\Program Files\calibre2\calibre-server.exe"  

; program arguments to be sent to executable 
options =-p 8081 --with-library "c:\calibre library" 

; can program interact with desktop [true | false] (default: true) 
desktop = false

; start type (valid values: Auto Manual Disabled) (default: auto) 
Start=Auto 

; start the service upon installation [true | false] (default: no)  
StartNow=false 

Thursday, May 16, 2013

Symlinks on Windows

Looks like Windows (7 at least) supports symlinks... finally!!  Yay.


    C:\>mklink
    Creates a symbolic link.

    MKLINK [[/D] | [/H] | [/J]] Link Target

            /D      Creates a directory symbolic link.  Default is a file
                    symbolic link.
            /H      Creates a hard link instead of a symbolic link.
            /J      Creates a Directory Junction.
            Link    specifies the new symbolic link name.
            Target  specifies the path (relative or absolute) that the new link
                    refers to.

Example


    C:\>mklink /D my-link h:\usr\htdocs
    symbolic link created for my-link <<===>> h:\usr\htdocs

    C:\>