Recently I ran into a SSL cert issue. I run a small e-commerce site and was doing some testing on it. Got to the buy now feature (when the site switches from non- SSL to SSL or http to https) I received a your SSL cert has expired. What? No I remember I purchased it forever ago but it shouldn’t be up now why did I have no warning?

Well with the help and guidance of the crew @ AwesomeIdeas I found a way to look up my SSL Certificate life.

copy & paste script below into a file called "CertExpirationCheck.vbs" and run the script from command line

When in the command prompt use the following parameter:

C:\> cscript certexpirationcheck.vbs [SubjectName]

C:\> cscript certexpirationcheck.vbs mikedopp.com

CertExpirationCheckScript

'**************************************************
'* CertExpirationCheck.vbs
'* Enumerate certificates with day left for expiry
'**************************************************

Option Explicit
Dim SubjectName
If WScript.Arguments.Count > 0 Then
SubjectName = LCase(WScript.Arguments(0))
Else
CommandUsage
End If

Dim Store, Certificates, Certificate
Const CAPICOM_LOCAL_MACHINE_STORE = 1
Const CAPICOM_CERTIFICATE_FIND_SUBJECT_NAME = 1
Const CAPICOM_STORE_OPEN_READ_ONLY = 0

Set Store = CreateObject("CAPICOM.Store")
Store.Open CAPICOM_LOCAL_MACHINE_STORE, "MY" ,CAPICOM_STORE_OPEN_READ_ONLY
Set Certificates = Store.Certificates.Find(CAPICOM_CERTIFICATE_FIND_SUBJECT_NAME, SubjectName, 0)

If Certificates.Count >0 Then
For Each Certificate in Certificates
'Certificate.display() 'If you want to see the Cert in UI
WScript.Echo "*** Subject " & Certificate.SubjectName & " ***"
WScript.Echo "Issued by " & Certificate.IssuerName
WScript.Echo "Valid from " & Certificate.ValidFromDate & " to " & Certificate.ValidToDate
WScript.Echo "Days to expiry " & DateDiff("d",now(),Certificate.ValidToDate)
WScript.Echo
Next
Else
WScript.Echo "No certificates with SubjectName => '" & SubjectName & "'"
End If

Set Certificates = Nothing
Set Store = Nothing

Sub CommandUsage
MsgBox "Usage: CertExpirationCheck.vbs [SubjectName] ", vbInformation,"CertExpirationCheck"
WScript.Quit(1)
End Sub
 
 

 

 

 

 

 

 

TitlePic

I know what your thinking. Oh crap here he goes again with recommending tools and or services. My question is have I ever steered you wrong?

Yes I normally deal in freeware tools. Mostly due to me being cheap and thinking my skills should push me past that latest issue with code. So why recommend a commercial tool? Good question. A friend recommended to me this tool. I had used tools like .net reflector to look into DLL’s to understand the application I am adding. I had heard rumor of NDepend however with all the different “N” products out there I was like another database OR mappers right? Or maybe another subversion type software.

So I downloaded the tool to see what if anything this tool had to offer. So once I downloaded the software and ran it. I was interested to see what it would do.

InstallNDependVS

 

 

 

 

 

 

 

 

 

 

It installed nicely into Visual Studio 2005 as well as Visual 2008. A plugin for an Addin for Reflector.

I wanted to see what it would do with one of my most complicated E-commerce applications (http://www.Buylifetime.com). I was surprised to notice the amount of extra DLL’s I was not in need of to make the application to work.

Simply put this application should be included with all Visual Studio Installs. It is that important. If Performance as well as clean code is important to you or your business you should have this to view all your important applications.

I would like to go over all the great features as well as the benefits however they are too much and too many to list.Purchase your copy today and see how much more rapid your development becomes.

  NDepend  includes a list of CQL rules and queries in VisualStudio that will update it in real-time each time the developer compiles. This way, the developer know as soon as he is doing a mistake. Also, the possibilituy to query the codebase real-time can be useful in Visual Studio.

 

 

Very Easy little command line to remote into an IIS machine. Using any windows box.

runas /noprofile /netonly /user:<Username>@<Domain> "iisreset <Machine Name>"

Domain can be substituted for IP.

Also another quick tip: Reset IIS gently iisreset /noforce

 

Enjoy!

 

Have you ever been working with a good number of applications at once? Are you a naturally born multi tasker? Alright, answer me this - who has had Windows buckle under the weight of all of these applications and display error messages stating that the system is out of memory or out of resources, buttons and menus do not work correctly, or you get an error sound but no message on the screen? I’ve hit this numerous times, to the point that I’ve lost work because of it…

(By the way, Adobe, can you please implement that little feature that Microsoft Office has had for years known as “auto save”? I don’t know how many times I’ve managed to completely max out Windows designing a web site and have had Photoshop fall over dead and disappear off my screen, only to find out that when I open Photoshop up again that the entire thing saved jack-all, all of those layers and documents gone poof into the void of darkness… if Microsoft can do it, why can’t you?)

Sometimes this happens even when you have a lot of system memory (RAM) still available. For instance, open up Internet Explorer and hold Ctrl+N to open up as many Internet Explorer windows as you can before menus, icons, and menus start displaying incorrectly, disappear, buttons aren’t clickable, etc. Close a few out and check your Windows Task Manager in the “Performance” tab, I bet you will find that a lot of your Physical Memory is still available.

This publication applies to:

    * Microsoft Windows 2000 Professional
    * Microsoft Windows 2000 Server
    * Microsoft Windows 2000 Advanced Server
    * Microsoft Windows XP Home Edition
    * Microsoft Windows XP Professional
    * Microsoft Windows XP Professional x64 Edition
    * Microsoft Windows XP Media Center Edition
    * Microsoft Windows XP Tablet PC Edition

DISCLAIMER: mikedopp.com and mikedopp hold no responsibility or liability whatsoever should something go wrong, or if you incorrectly modify the Windows Registry. Please take extreme caution while following this publication and follow the steps correctly.

“Okie-dokie, if I have all of this memory still available, why is Windows saying I’m out of memory and out of system resources!?”

Simple. You have hit the “user handle” or “GDI handle” limit in Windows. This limit is there for two reasons:

    * Leaky applications or faulty code & malware can’t easily crash the system by attempting to overflow the system with GDI handles, making everything un-usable until a reboot is performed.
    * To prevent a user from opening up more applications than the system can handle.

If you have 1 gigabyte (or 1024MB) of RAM or higher, the default User Handle and GDI Handle limits can be pretty restrictive when running a large working set of applications that demand the most from your system and tax it heavily.

“Do you feel my pain?”

Yes, of course. Otherwise, I wouldn’t be writing this article that is more than likely a good 2 or 3 pages in length.

I’m a designer and coder, I use Adobe Photoshop with a lot of documents opened up - on top of that, I usually listen to music while working as it helps me work better, so Windows Media Player 10 is usually open on my machine. Also opened are Windows Messenger, Microsoft Office Outlook 2003, SmartFTP (one of the best FTP clients I’ve ever used, highly recommended), Microsoft Word, a few dozen Internet Explorer windows, some Mozilla Firefox windows with a few tabs opened in each one, and EditPlus 2 for coding.

That’s a pretty heavy working set of applications, and I demand the most out of my computer when it comes to multitasking (I have a Pentium 4 2.66GHz, with 1.5GB of RAM just for those who are wondering).

I too have nailed these handle limits - more than once. After much searching and pondering I have finally come up with a working solution around this issue (hurray!)

“Yeah yeah, stop rambling and cut to the chase!”

First and foremost, I must warn you that modifying these settings incorrectly can render your Windows installation near useless. Also, depending on your computer configuration and the amount of RAM in your system, you may wish to play around with the numbers until you find a setting that is perfect for your computer.

To back up everything, open the Registry Editor (click on Start, Run, and then type “regedit.exe” (without the quotes).

To backup a registry key:

    * In the Registry Editor on the left hand side, you will see the navigation pane. Using your mouse or keyboard, navigate to the following subkeys:

    * HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\SubSystems
    * HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Windows
    * Right click on each of the subkeys above in the left hand pane and from the context menu that appears, choose the “Export” option. Save the exported registry data file where ever you wish, but make sure that it will be accessible should we need to restore the files.

“OK, I’ve backed everything up! Now what!?”

Don’t quit the Registry Editor just yet - we still need to make some modifications in order to increase the handle limits in Windows.

With the Registry Editor opened, navigate to HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\SubSystems. You will notice a set of “REG_MULTI_SZ” and “REG_EXPAND_SZ” keys in the right hand pane. The one that we are interested in modifying is called “Windows”.

To modify the key, double click on it. It should look something like this:

    %SystemRoot%\system32\csrss.exe ObjectDirectory=\Windows SharedSection=1024,3072,512 Windows=On SubSystemType=Windows ServerDll=basesrv,1 ServerDll=winsrv:UserServerDllInitialization,3 ServerDll=winsrv:ConServerDllInitialization,2 ProfileControl=Off MaxRequestThreads=16

The section of this string we are interested in modifting is “SharedSection”.

In the SharedSection part of the string you will notice 3 numbers. What we are interested in is the middle value, “3072?. Modify this value so that the middle number is “8192?.

It should look something like this after modifying the value:

    %SystemRoot%\system32\csrss.exe ObjectDirectory=\Windows SharedSection=1024,8192,512 Windows=On SubSystemType=Windows ServerDll=basesrv,1 ServerDll=winsrv:UserServerDllInitialization,3 ServerDll=winsrv:ConServerDllInitialization,2 ProfileControl=Off MaxRequestThreads=16

Now that we’ve changed this, lets continue, shall we?

In the left hand pane of the Registry Editor, navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows. In the right hand side, you will see two REG_DWORD values, named “GDIProcessHandleQuota” and “USERProcessHandleQuota”. We will need to modify both of these.

The first key we will want to modify is “GDIProcessHandleQuota”. This keys value can be set between 256 and 16,384 (maximum), and the default value is 10,000. I’d recommend using 15,000 as a value for this key, however if you are doing a lot of multitasking, shoot for the stars and go with 16,384.

This key can not be set past 16,384 as it is the maximum acceptable value.

Now, lets modify “USERProcessHandleQuota”. This keys value can be set between 200 and 18,000 (maximum), with a default value of 10,000. I’d recommend increasing this value to the same number used with “GDIProcessHandleQuota”, however as previously mentioned if you are working with a hefty application workload, shoot for the stars and go wth the maximum value of 18,000.

This key can not be set past 18,000 as it is the maximum acceptable value.

Do NOT attempt to increase these values past the maximum - Windows will become very unstable and may even stop working correctly. If Windows starts acting up after changing these values, lower them until the issues are resolved, or restore the backups of these keys’ values that we created before making modifications.

Now that you’ve changed these values, restart your computer and tax the system using the Internet Explorer trick mentioned previously - open Internet Explorer and hold down Ctrl+N on your keyboard to open up new Internet Explorer windows. Continue this until menus, buttons, and user interface elements stop working correctly. Also, open any applications you run day-to-day while you are performing this, so that you can get more of an idea if you have everything configured correctly.

You may also want to monitor your memory usage and handles information in Task Manager to see whether or not the above registry values need any more modifications.

I hope this helps with any multi-tasking issues you may have run into while running Microsoft Windows, now get back to work!

Ever need a quick and dirty way to check the MD5 Hash on any compressed folder or executable?

At Work: Joe and I have had the occasional corrupt file from Microsoft and had to pull out of installing patches and such. This was a problem and a time waster. So in every deployment of any project we decided to be sticklers on checking the hashes. While yes there is a few utilities on the interweb or ExtraNet (both very bad slang for Internet) I have settled for the non installing executable to do my Hash Checking.

Some have even commented: "If your such a great developer why don't you write your own?" I suppose I could however I have little time to rewrite the wheel.

WinMD5Free

Have a look and enjoy.

WinMD5 Web Site

winmd5free.zip

Hashes for safety:

WinMD5Free.zip MD5: 73f48840b60ab6da68b03acd322445ee

WinMD5Free.exe MD5: 944a1e869969dd8a4b64ca5e6ebc209a

 

Have you ever been styling your page and the design asks for a 1px dotted?

Take a moment breath and I mean breath without expelling a whole lot of cuss words due to the fact IE 6 and 7 see 1px dotted as a solid line.

Let the designer know you have to bump up the pixels to 2px for dotted lines to work.

This hint would have helped me in hours of pulling out my hair and arguments.

Enjoy!

If your like me you develop in multiple servers. Using Terminal Services is a easy way to move through these servers remotely and with ease. Often I have 6 or more Remote Sessions open at one time. This as you can well imagine can get very confusing. I got to the point I felt I needed better way to brand my Desktop sessions. I tried wallpaper which by the way works well also. However this trick works as a supplement to the wallpaper trick.This registry edit will add text to the login string on the login after you hit "ctrl alt delete" giving you a chance to identify the machine in case you get confused.

"

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon]

"welcome"="Good Times Enter your own welcome message here"

 

"

Most of you would rather the the first title before or.
Can't Remeber where I got most of this script(if you know please send me a hate email) however I did some enhancements and I am reposting it.

DECLARE @DBName varchar(255)

DECLARE @DATABASES_Fetch int

DECLARE DATABASES_CURSOR CURSOR FOR
    select
        DATABASE_NAME   = db_name(s_mf.database_id)
    from
        sys.master_files s_mf
    where
       -- ONLINE
        s_mf.state = 0

       -- Only look at databases to which we have access
    and has_dbaccess(db_name(s_mf.database_id)) = 1

        -- Not master, tempdb or model
    and db_name(s_mf.database_id) not in ('Master','tempdb','model')
    group by s_mf.database_id
    order by 1

OPEN DATABASES_CURSOR

FETCH NEXT FROM DATABASES_CURSOR INTO @DBName

WHILE @@FETCH_STATUS = 0
BEGIN
    declare @DBFileName varchar(256)   
    set @DBFileName = datename(dw, getdate()) + ' - ' +
                       replace(replace(@DBName,':','_'),'\','_')+ '.BAK'

    exec ('BACKUP DATABASE [' + @DBName + '] TO  DISK = N''D:\dbbackup\' +
        @DBFileName + ''' WITH NOFORMAT, INIT,  NAME = N''' +
        @DBName + '-Full Database Backup'', SKIP, NOREWIND, NOUNLOAD,  STATS = 100')

    FETCH NEXT FROM DATABASES_CURSOR INTO @DBName
END

CLOSE DATABASES_CURSOR
DEALLOCATE DATABASES_CURSOR

Make sure the backup path exists on the server.

To restore it, go to

Tools >

Options >

Text Editor >

C# >

General and check "Auto list members" and "Parameter information" checkboxes.

 

I know, I know, Everyone and their dog has one of these (Blog posts about IIS SMTP Setup). So of course I couldn't leave my fifi (my dog (virtual of course(made up for the story))) out.

I have been messing around with email alerts from all my ASP.NET 2.0 Applications of course and of course I love the IIS server piece of Windows xp - 200x. One thing that has always beguiled (had to look up that word to make sure proper use) me is the SMTP server. Now all of you Windows Web Masters (System Administrators of the Web) are going to roll your eyes at me. That's  cool this post is mostly a reminder to me. 

 

When Setting up ASP.NET 2.0 Web Apps in SMTP Here is the configuration you want to put into your web.config.

Make sure the <network host="the IP address of the server not localhost or 127.0.01" />for whatever reason and I am sure there is a good one this does not work.

<system.net>
    <mailSettings>
      <smtp deliveryMethod="Network" from="esupport@yourcompany.com">
        <network host="your IP address"  port="25" userName=you@yourcompany.com/>
      </smtp>
    </mailSettings>
  </system.net>

 

SMTP Side Make sure you setup Relay to just the IP address of your server and you could add the localhost.

All will work and the world can now be spammed by another IIS Server.

 

 

 

 

Flickr Tags: , ,

BuzzNet Tags: , ,

Technorati Tags: , ,

del.icio.us Tags: , ,

IceRocket Tags: , ,

LiveJournal Tags: , ,

LiveJournal Tags: , ,
More Posts « Previous page - Next page »