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

Tuesday, September 15, 2015

Certificates : Getting User and Local Computer stores

For Windows 8 upwards, you can get this from the Modern Tiles method (thanks to Brady Gaster for the tip).

Search for user,cer and then click on "Manage user certificates".


You then get the "Current User" portion of the usual mmc plug-in.


Search for computer,cer and then click on "Manage computer certificates".


You then get the "Local Computer" portion of the usual mmc plug-in.


Enjoy!

Tuesday, January 20, 2015

DOS : long file names

There are times when long file names are a pain.

I had a batch file that called a file inside a directory and the directory had spaces in the name e.g.

c:\a long name\another long name\program.exe

And it wouldn't damn well find it. Kept getting error messages like "File x ...".

I used "" and everything else I could think of.

Then from a long-distant past, I remembered DOS and the command

dir /x

This displays the short names generated for non-8dot3 file names.

So e.g. C:\Program Files\Resource Kit becomes C:\PROGRA~1\RESOUR~1

Putting the short name in the batch file solved the problem.

Go figure.

Enjoy!



Monday, March 24, 2014

Windows : Ctrl - Alt - Del on a VM

If you use Remote Desktop a lot and you get a message about your password needing to change, you can't use:

Ctrl - Alt - Del

because that will change the password on your actual PC - not the box you are RDC'ing to.

All the documentation states:

Ctrl - Alt - End

but sometimes that simply doesn't work.

In such cases, in the RDC window, try Start - Run - OSK.

This pops up the On Screen Keyboard.

Than hold down Ctrl and Alt on your actual keyboard and then click Delete on the OSK.

Job done!

Enjoy!



Thursday, September 13, 2012

Windows : File names that start with a period

 

If you play around with Java on your Windows box, sooner or later you are going to hit the problem where you need to create a file that starts with a period (aka. dot or full stop) e.g. “.keypass”.

Explorer won’t let you do this.

The solution is to create a file called keypass (no period) in Explorer and then use the command prompt to run a DOS command:

ren keypass .keypass

“ren” = “rename”

Good, old DOS to the rescue!

Enjoy!

Thursday, September 08, 2011

Windows : The “hidden” tools

 

There’s an amazing amount of tools “hidden” on your PC that you probably aren’t even aware off Smile.

A lot of them are stored in the

C:\Program Files\Microsoft SDKs\Windows

directory. These mainly derive from the Windows SDK for Windows 7 and .NET Framework 4.

Browse through StartTools.htm located at:

C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin

There’s an amazing collection of tools there.

The actual binaries are located here:

C:\Program Files\Microsoft SDKs\Windows\v7.0A\bin

To quote:

“The Windows SDK tools are designed to make it easier for you to create, deploy, and manage applications and components that target Windows and the Internet. The Windows SDK includes tools for both the .NET 3.5 SP1 and 4 Frameworks - a managed programming model - and tools for Win32® - the native (unmanaged) programming model for Windows. Many of the Windows SDK tools are listed on this page and categorized by target audience: managed, native and "common" (tools that could be used by either managed or native developers).”

Enjoy!

Wednesday, July 13, 2011

Windows : Windows Integrated Authentication

This is for Windows Integrated Authentication (IWA / WIA)

If you want to use this to automatically log into other sites that you access after logging in once when you come into work:

The site you want to access has to be in the “Local Intranet” zone.

The WIA setting in the IIS site – Authentication icon should be set.

For IE (which can do this behind the scenes):

  • Tools / Internet Options / Security / Custom Level (Scroll down to end) / Automatic login only in Intranet zone
  • Tools / Internet Options / Advanced (Scroll down to Security) / Enable Windows Integrated Authentication.

For Firefox, see

FireFox supports Integrated Windows Authentication

Also:

Configuring Windows Integrated AuthN

Note there are three articles here.

and

SSO with Office 365: ADFS Logon Web Site / Authentication / Browser Support

and

AD FS, Enhanced Protection for Authentication (EPA), Chrome and Integrated Windows Authentication (IWA)

Enjoy!

Thursday, April 28, 2011

Powershell : Getting a list of commands

Powershell is a useful tool if you like a command line interface.

Although it has a pretty comprehensive list of help commands, quite often you can't remember the exact command.

e.g. you remember that the command had the word "item" in it.

So use:

get-command *item*

which gives you a list of all commands that contain the phrase "item".

Enjoy!

Friday, November 26, 2010

Web services : cURL

If you need to do some web service client testing, there are a number of tools like SOAPUI but they all involve installing programs etc.

Then I came across this neat tool cURL

To quote from the docs:

"curl is a command line tool for transferring data with URL syntax, supporting DICT, FILE, FTP, FTPS, GOPHER, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMTP, SMTPS, TELNET and TFTP. curl supports SSL certificates, HTTP POST, HTTP PUT, FTP uploading, HTTP form based upload, proxies, cookies, user+password authentication (Basic, Digest, NTLM, Negotiate, kerberos...), file transfer resume, proxy tunneling and a busload of other useful tricks."

It runs on a wide variety of platforms.

So how do you use it to test a web service?

You need to mock-up what the actual SOAP packet looks like e.g.

to test a web service called TestWS, the information might look like:






123456
Joe
Bloggs





Save this in a file called TestWS.xml.

The command line for cURL would then be:

curl --data @TestWS.xml --header "Content-Type: text/xml" --header "Accept-Encoding: gzip,deflate" --verbose http://host:port/TestWSService


This then sends the HTTP POST which itself contains a SOAP message which invokes the web service.

The verbose option prints out both the request and the response.

Enjoy!

Tuesday, November 23, 2010

Java : Checking if environment variables are valid

Has a few problems with environment variables and I couldn't find a utility that would check them for me e.g. checking if all the entries in my PATH environment variable were valid.

So I rolled my own:


public class CheckEnv {

/**
* @param args the command line arguments
*/
static String envVar = "";
static String envValue = "";
static String envValueStrings[];
static String envValueString = "";
static boolean valid = false;

public static void main(String[] args) {
// TODO code application logic here

if (args.length < 1) {
System.out.println("\nUsage is 'java -jar CheckEnv.jar '");
System.out.println();
System.out.println(" e.g. 'java -jar CheckEnv.jar PATH'");
System.out.println(" 'java -jar CheckEnv.jar CLASSPATH'");
System.out.println(" 'java -jar CheckEnv.jar INCLUDE'");
System.out.println(" 'java -jar CheckEnv.jar LIB'");
System.exit(1);
}

envVar = args[0];

envValue = System.getenv(envVar);

System.out.println ("\nChecking for environment variable " + envVar + "\n");

if (envValue == null)
{
System.out.println ("Environment variable " + envVar + " doesn't exist");
System.exit(1);
}

envValueStrings = envValue.split(";");

for (int i = 0; i < envValueStrings.length; i++) {
envValueString = envValueStrings[i];

System.out.print("Checking " + envValueString + " ");

File file = new File(envValueString);
valid = file.exists();

if (valid) {
System.out.println("- variable exists");
} else {
System.out.println("- variable does not exist : WARNING");
}

}
}
}



Usage is 'java -jar CheckEnv.jar '

e.g. 'java -jar CheckEnv.jar PATH'
'java -jar CheckEnv.jar CLASSPATH'
'java -jar CheckEnv.jar INCLUDE'
'java -jar CheckEnv.jar LIB'


The output looks like e.g.


Checking C:\Program Files\Java\jdk1.6.0_22\jre\bin - variable exists
Checking C:\Program Files\Reflection - variable exists
Checking C:\Perl\bin\ - variable exists


Enjoy!

Tuesday, July 07, 2009

Notepad++ : Error with nppcm.dll

Use this freebie program a lot as a simple text editor on Windows XP. I used the right context click plugin which one day suddenly came up with:

""Error creating process: nppcm.dll needs to be in the same directory than notepad++.exe"

Mr Google to the rescue and found the answer.

There is a file in the root of the hard drive called 'Program' - no extension.

Delete this file and all is sweetness and light!

Enjoy!

Monday, March 16, 2009

Java : Checking version on your PC

Came across a nice feature that does this from the Sun web site.

Verify Java installation

If your installation is out-of-date, just click on the link and the latest one is installed.

Very handy!

Enjoy!

Monday, February 16, 2009

XP : DOS equivalent of Traceroute

I've used Traceroute often to trace the path between two hosts and highlight potential bottlenecks.

But it is not a Windows program. However, "PathPing" is a network utility in XP.

"It combines the functionality of Ping with that of Traceroute (in Windows: tracert), by providing details of the path between two hosts and Ping-like statistics for each node in the path based on samples taken over a time period".


C:\>pathping

Usage: pathping [-g host-list] [-h maximum_hops] [-i address] [-n]
[-p period] [-q num_queries] [-w timeout] [-P] [-R] [-T]
[-4] [-6] target_name

Options:
-g host-list Loose source route along host-list.
-h maximum_hops Maximum number of hops to search for target.
-i address Use the specified source address.
-n Do not resolve addresses to hostnames.
-p period Wait period milliseconds between pings.
-q num_queries Number of queries per hop.
-w timeout Wait timeout milliseconds for each reply.
-P Test for RSVP PATH connectivity.
-R Test if each hop is RSVP aware.
-T Test connectivity to each hop with Layer-2 priority tags.
-4 Force using IPv4.
-6 Force using IPv6.


Or (as above), use tracert.


C:\>tracert

Usage: tracert [-d] [-h maximum_hops] [-j host-list] [-w timeout] target_name

Options:
-d Do not resolve addresses to hostnames.
-h maximum_hops Maximum number of hops to search for target.
-j host-list Loose source route along host-list.
-w timeout Wait timeout milliseconds for each reply.


Enjoy!

Monday, July 28, 2008

Misc : Error 0X80070052 on USB Flash Drives

I came across this at the weekend.

Trying to copy some files from a DVD to a flash drive and kept getting this error.

Tried everything - reformatted etc. but no joy.

So Mr. Google to the rescue.

One link suggested that the problem was that there is a limit to the number of files you can copy to the root directory of a USB drive.

Sounded suspect but made a folder under root and then copied the files to the folder.

Suddenly everything worked!

Amazing!

Enjoy!

Thursday, June 05, 2008

XP : Find that missing USB drive

I have a USB drive that simply will not load on one of my PC's.

The PC simply wouldn't recognise the drive no matter what I did.

So Mr. Google to the rescue.

I found the answer here.

The problem was "More than likely the cause is that Windows renamed the drive to a letter that is already in use. This will happen if you have several card readers, thumb drives or external hard drives attached. It will also happen if you are on a network and have mapped drives".

After following the advice, all was well.

Enjoy!

Wednesday, July 18, 2007

Misc : Cracking XP Administrator passwords

Check out this site:

http://www.loginrecovery.com/

"Login Recovery is a service to reveal user names and recover passwords for Windows NT, 2000, XP, 2003 and Vista. As long as you have physical access to the computer, your passwords can be recovered

By following three simple steps, over 98.5% of passwords can be recovered within less than ten minutes. This service does not overwrite passwords, it does not write anything to the hard drive, it does not alter the computer in any way.

For immediate access to decrypted passwords, the priority service is available for GBP 12.95 + VAT (£15.22) (approx USD 25 or EUR 20). Alternatively a free service is available by waiting up to 48 hours (One free request every three months)."


Works like a charm as long as you don't mind waiting 48 hours!

Enjoy!

Thursday, July 05, 2007

DOS 'grep' equivalent - the find command

The previous post talked about finding which ports were open using the netstat command.

But you still have to scan the output manually to find the port you are looking for.

In the Unix world you could simply use grep and pipe the output to it.

In the DOS world, you can use find.


help find

Searches for a text string in a file or files.

FIND [/V] [/C] [/N] [/I] [/OFF[LINE]] "string" [[drive:][path]filename[ ...]]

/V Displays all lines NOT containing the specified string.
/C Displays only the count of lines containing the string.
/N Displays line numbers with the displayed lines.
/I Ignores the case of characters when searching for the string.
/OFF[LINE] Do not skip files with offline attribute set.
"string" Specifies the text string to find.
[drive:][path]filename
Specifies a file or files to search.

If a path is not specified, FIND searches the text typed at the prompt
or piped from another command.



So to find if port 86 was open, use:

netstat -ano | find /i "86"

and the filtered output would something like:



TCP 0.0.0.0:86 0.0.0.0:0 LISTENING 728
UDP 0.0.0.0:86 *:* 728



Enjoy!

Which XP ports are open?

Don't know how many times I see the message "Error - port 8080 already in use" or some such.

So how do you find whose using that port. One answer is netstat which runs in a cmd window:


Displays protocol statistics and current TCP/IP network connections.

NETSTAT [-a] [-b] [-e] [-n] [-o] [-p proto] [-r] [-s] [-v] [interval]

-a Displays all connections and listening ports.
-b Displays the executable involved in creating each connection or
listening port. In some cases well-known executables host
multiple independent components, and in these cases the
sequence of components involved in creating the connection
or listening port is displayed. In this case the executable
name is in [] at the bottom, on top is the component it called,
and so forth until TCP/IP was reached. Note that this option
can be time-consuming and will fail unless you have sufficient
permissions.
-e Displays Ethernet statistics. This may be combined with the -s
option.
-n Displays addresses and port numbers in numerical form.
-o Displays the owning process ID associated with each connection.
-p proto Shows connections for the protocol specified by proto; proto
may be any of: TCP, UDP, TCPv6, or UDPv6. If used with the -s
option to display per-protocol statistics, proto may be any of:
IP, IPv6, ICMP, ICMPv6, TCP, TCPv6, UDP, or UDPv6.
-r Displays the routing table.
-s Displays per-protocol statistics. By default, statistics are
shown for IP, IPv6, ICMP, ICMPv6, TCP, TCPv6, UDP, and UDPv6;
the -p option may be used to specify a subset of the default.
-v When used in conjunction with -b, will display sequence of
components involved in creating the connection or listening
port for all executables.
interval Redisplays selected statistics, pausing interval seconds
between each display. Press CTRL+C to stop redisplaying
statistics. If omitted, netstat will print the current
configuration information once.



so netstat -ano gives



Active Connections

Proto Local Address Foreign Address State PID
TCP 0.0.0.0:86 0.0.0.0:0 LISTENING 728
TCP 0.0.0.0:135 0.0.0.0:0 LISTENING 1192
TCP 0.0.0.0:261 0.0.0.0:0 LISTENING 3684
...





You can look up the PID using Task Manager or (even better) using sysinternals Process Explorer (which you can get from here).

Their version of netstat is TCPView (which you can get from here).

Enjoy!

Wednesday, April 11, 2007

Windows : Getting a file list

Often need to put a list of files into a Word document or some such.

One way is to activate the command prompt (DOS box), navigate to the required directory and type:

dir /ON /B > dir.txt

The /ON option lists the files in alphabetic order. Further options are:


/O List by files in sorted order.
sortorder N By name (alphabetic) S By size (smallest first)
E By extension (alphabetic) D By date/time (oldest first)
G Group directories first - Prefix to reverse order


The /B option uses a bare format (i.e. no heading information or summary).

The pipe option (>) sends the results to a file called dir.txt in the current directory.

From here, it can be cut & pasted into the Word document.

BTW, if you ever need to get information about a DOS command, type:

help "command"

e.g. help dir

Enjoy!