Monday, February 28, 2011

How to clear the print spool

[Windows users]


  1. Click "start" and go to "Run"
  2. Type "services.msc" at the prompt which will open the Services
    window (ooh, pretty...)
  3. Scroll down the alphabetical list in the right window pane until you come
    to the entry with the name "Print Spooler"
  4. Right-click this entry, then select "stop". This will stop the computer
    running the process that holds your print queues.
  5. Leaving that window open for now, click again on "Start", and then click
    "My Computer" to open a Windows Explorer window.
  6. We've stopped the queue service, now we just have to clear the jam that is
    already there. To do this we navigate to the print spool folder which is hiding
    within the Windows folders. Usually Windows is installed on C: drive, but you
    should be easily able to tell when the Explorer window opens which drive it is
    on.

    The usual path to the spool folder is
    C:\WINDOWS\system32\spool\PRINTERS, but yours may be slightly
    different. Your windows drive may have another name for instance, but this would
    be uncommon. So click on your Windows drive (usually C), then double-click on
    the Windows folder, and then find the System32 folder and double-click on
    that. Windows may warn you that you are about to view system files, but click
    "View files anyway" message and search out the "spool folder". Within the
    Spool folder is your Printers folder, and you should open
    that.
  7. Delete every file within this folder to empty the jammed print queue
    (pressing the "ctrl" and "a" keys will select all files and then you can just
    hit "delete").
  8. Close the explorer window now that we have emptied the cleared spool files,
    and return to your Services window. we must re-start the Print spool
    service, and do so by right-clicking the Print Spool entry and selecting
    "Start" from the list. Close the services window and try printing again

If your print spool folder contained no files to delete, then this article will
obviously not be the appropriate solution to your issue.

Sunday, February 27, 2011

How to deploy PowerShell script via group policy?


Question

PowerShell is a becoming a very powerful way to administrate Windows systems. If you want to deploy a PowerShell script on domain clients, how can you do it via group policy?

Answer
In Windows 7 and Windows Server 2008 R2, the UI in Group Policy Editor for Logon, Logoff, Startup, Shutdown scripts now has an extra tab for PowerShell scripts. You can simply add your PowerShell script to this tab to deploy it.

1.       Create or edit a GPO on Windows Server 2008 R2 or Windows 7 with RSAT.
2.       Navigate to
[Computer Configuration\Policies\Windows Settings\Scripts]
Or
[User Configuration\Policies\Windows Settings\Scripts]
3.       Double-click Startup/Shutdown or Logon/Logoff, switch to PowerShell Scripts tab and add PowerShell script files.

More Information
For more information about PowerShell, please refer to the following links:
Scripting with Windows PowerShell

Windows PowerShell Getting Started Guide

Applies to
Windows 7
Windows Server 2008 R2

Thursday, February 24, 2011

Outlook signature based on user information from Active Directory


Step-by-step
1) Download the script from here. Save it to a UNC-path accessible for all users.
2) Adjust the custom variables:




3) From an Outlook client, create a signature based on your company template:


4) Copy the signature files from %appdata%\Microsoft\Signatures to the UNC-path specified in the SigSource-variable in the script:


5) Open both Company Name.rtf and Company Name.htm in Microsoft Office Word and insert the following bookmarks:


Mark each word, e.g. “EmailAddress”, go to “Insert”, press the “Bookmark”-button and name the bookmark “EmailAddress”. It`s important that the names of the bookmarks are “DisplayName”, “Title”, “TelephoneNumber” and “EmailAddress”.
This is because these bookmarks are replaced by the information retrieved from Active Directory for the logged-on user.
6) When appropriately tested, deploy the script to end users. This may be accomplished by e.g. Group Policy:


Additional information
Sample signature created using Set-OutlookSignature.ps1:


Active Directory object for sample user:


Settings are stored in HKCU in the registry:


A few notes:
-Existing signatures are preserved
-Users are allowed to make customizations to their signatures until a new version is deployed. Then the exisiting company-signature will be overwritten.

Monday, February 21, 2011

Outlook 2007 Backup and File Locations


Windows XP File Locations

Where do you find these files? You can always start by using your operating system's Search or Find command to locate the particular file types. You may need to use Tools | Folder Options | View in Windows Explorer and select Show hidden files and folders.
When using Windows 2000/XP, Outlook stores *ost, *.oab, and extend.dat in C:\Documents and Settings\\Local Settings\Application Data\Microsoft\Outlook. Extend.dat and MSN Connector message stores can not be moved. See How to move the IMAP personal folder (*.pst) for the proper way to move IMAP and Internet Subscription folders.
All other Outlook configuration files are stored in C:\Documents and Settings\\Application Data\Microsoft\Outlook and cannot be moved.
Tip: Copy and paste these lines in Windows Explorer address bar to open the folder:
To access the folder holding the toolbar, VBA, rules, and nickname files, copy and paste:
To see the message store files, copy and paste:
Note: Storing Personal Folders on an network file share is not recommended and may cause corruption and data loss.
Type of File Name or Extension Outlook Profile Specific Folder Location under the User Account path (C:\Documents and Settings\\)
Personal Folders .pst files   Local Settings\Application Data\Microsoft\Outlook (default, but .pst files can be anywhere on system)
Offline and Cache folders used by Exchange server, MSN's Outlook connector. .ost files   Local Settings\Application Data\Microsoft\Outlook(default, can be moved to anywhere on the system)
Nicknames for AutoComplete .nk2 files   \Application Data\Microsoft\Outlook
Customized print settings OutlPrnt   \Application Data\Microsoft\Outlook
Customized toolbar settings Outcmd.dat   \Application Data\Microsoft\Outlook
Macros and VBA programs VbaProject.otm   \Application Data\Microsoft\Outlook
Navigation bar customizations .xml files X \Application Data\Microsoft\Outlook
Send/Receive group settings .srs files X \Application Data\Microsoft\Outlook
Signatures .rtf, .htm, and .txt files X \Application Data\Microsoft\Signatures
Stationery .htm files   \Application Data\Microsoft\Stationery
Templates .oft files   \Application Data\Microsoft\Templates
Dictionary .dic files   \Application Data\Microsoft\Proof
Installed Add-ins extend.dat   Local Settings\Application Data\Microsoft\Outlook
Do not backup or copy this file, Outlook will create a new copy.
Safe and Blocked senders lists Stored in mailbox as a hidden message   Can be exported from Tools, Options, Junk E-mail. Export each list separately.


Vista and Windows 7 File Locations

Where do you find these files? You can always start by using your operating system's Search or Find command to locate the particular file types. On Vista you may need to browse to Windows Explorer's Organize | Folder and Search Options | View tab and select Show hidden files and folders.
Vista replaces Documents and Settings folder path with a Users path. As a result, in Vista you'll find Outlook stores the PST and  OST, in C:\Users\\AppData\Local\Microsoft\Outlook.
Live Connector message stores can not be moved but POP3 and Exchange offline or cache storage can be moved to other locations. See How to move the IMAP personal folder (*.pst) for the proper way to move IMAP and Internet Subscription folders.
All other Outlook configuration files are stored in C:\Users\\AppData\Roaming\Microsoft\Outlook and cannot be moved.
Tip: Copy the following lines and paste into Vista's Start menu "Start Search" field to open these folders:
To access the folder holding the toolbar, VBA, send & receive settings, and nickname files, copy and paste:
To see the message store files, copy and paste:
Note: Storing Personal Folders on an network file share is not recommended and may cause corruption and data loss.
Type of File Filename or Extension Outlook Profile Specific Folder path under C:\Users\\AppData\
Personal Folders (including SharePoint Lists) .pst   Local\Microsoft\Outlook
Offline and Cached mode folders used by Exchange server and the Outlook connector. .ost   Local\Microsoft\Outlook
RSS feeds in Outlook 2007 .sharing.xml.obi X Local\Microsoft\Outlook
Installed Add-ins extend.dat   \Local\Microsoft\Outlook
This file does not need to be backed up, Outlook will create a new copy.
Nicknames for AutoComplete .nk2 X Roaming\Microsoft\Outlook
Customized print settings OutlPrnt   Roaming\Microsoft\Outlook
Customized toolbar settings Outcmd.dat   Roaming\Microsoft\Outlook
Navigation bar customizations .xml files X Roaming\Microsoft\Outlook
Send/Receive group settings (Outlook 2002 and later) .srs files X Roaming\Microsoft\Outlook
Macros and VBA programs VbaProject.otm   Roaming\Microsoft\Outlook
Signatures .rtf, .htm, and .txt files X \Roaming\Microsoft\Signatures
Stationery .htm files   \Roaming\Microsoft\Stationery
Templates .oft files   \Roaming\Microsoft\Templates
Dictionary .dic files   \Roaming\Microsoft\Proof
Outlook 2007 Safe and Blocked senders lists Stored in message store as a hidden message   Can export each list to a text file as backup. Tools, Options, Junk Email options. Export each list separately. 

Saturday, February 12, 2011

How to convert a numeric value into English words in Excel

This article contains sample Microsoft Visual Basic for Applications functions that you can use to convert a numeric value in a Microsoft Excel worksheet cell into its equivalent in English words.



How to create the sample function Called SpellNumber

  1. Start Microsoft Excel.
  2. Press ALT+F11 to start the Visual Basic Editor.
  3. On the Insert menu, click Module.
  4. Type the following code into the module sheet.
Code:

Option Explicit
'Main Function
Function SpellNumber(ByVal MyNumber)
    Dim Dollars, Cents, Temp
    Dim DecimalPlace, Count
    ReDim Place(9) As String
    Place(2) = " Thousand "
    Place(3) = " Million "
    Place(4) = " Billion "
    Place(5) = " Trillion "
    ' String representation of amount.
    MyNumber = Trim(Str(MyNumber))
    ' Position of decimal place 0 if none.
    DecimalPlace = InStr(MyNumber, ".")
    ' Convert cents and set MyNumber to dollar amount.
    If DecimalPlace > 0 Then
        Cents = GetTens(Left(Mid(MyNumber, DecimalPlace + 1) & _
                  "00", 2))
        MyNumber = Trim(Left(MyNumber, DecimalPlace - 1))
    End If
    Count = 1
    Do While MyNumber <> ""
        Temp = GetHundreds(Right(MyNumber, 3))
        If Temp <> "" Then Dollars = Temp & Place(Count) & Dollars
        If Len(MyNumber) > 3 Then
            MyNumber = Left(MyNumber, Len(MyNumber) - 3)
        Else
            MyNumber = ""
        End If
        Count = Count + 1
    Loop
    Select Case Dollars
        Case ""
            Dollars = "No Dollars"
        Case "One"
            Dollars = "One Dollar"
         Case Else
            Dollars = Dollars & " Dollars"
    End Select
    Select Case Cents
        Case ""
            Cents = " and No Cents"
        Case "One"
            Cents = " and One Cent"
              Case Else
            Cents = " and " & Cents & " Cents"
    End Select
    SpellNumber = Dollars & Cents
End Function
      
' Converts a number from 100-999 into text 
Function GetHundreds(ByVal MyNumber)
    Dim Result As String
    If Val(MyNumber) = 0 Then Exit Function
    MyNumber = Right("000" & MyNumber, 3)
    ' Convert the hundreds place.
    If Mid(MyNumber, 1, 1) <> "0" Then
        Result = GetDigit(Mid(MyNumber, 1, 1)) & " Hundred "
    End If
    ' Convert the tens and ones place.
    If Mid(MyNumber, 2, 1) <> "0" Then
        Result = Result & GetTens(Mid(MyNumber, 2))
    Else
        Result = Result & GetDigit(Mid(MyNumber, 3))
    End If
    GetHundreds = Result
End Function
      
' Converts a number from 10 to 99 into text. 
Function GetTens(TensText)
    Dim Result As String
    Result = ""           ' Null out the temporary function value.
    If Val(Left(TensText, 1)) = 1 Then   ' If value between 10-19...
        Select Case Val(TensText)
            Case 10: Result = "Ten"
            Case 11: Result = "Eleven"
            Case 12: Result = "Twelve"
            Case 13: Result = "Thirteen"
            Case 14: Result = "Fourteen"
            Case 15: Result = "Fifteen"
            Case 16: Result = "Sixteen"
            Case 17: Result = "Seventeen"
            Case 18: Result = "Eighteen"
            Case 19: Result = "Nineteen"
            Case Else
        End Select
    Else                                 ' If value between 20-99...
        Select Case Val(Left(TensText, 1))
            Case 2: Result = "Twenty "
            Case 3: Result = "Thirty "
            Case 4: Result = "Forty "
            Case 5: Result = "Fifty "
            Case 6: Result = "Sixty "
            Case 7: Result = "Seventy "
            Case 8: Result = "Eighty "
            Case 9: Result = "Ninety "
            Case Else
        End Select
        Result = Result & GetDigit _
            (Right(TensText, 1))  ' Retrieve ones place.
    End If
    GetTens = Result
End Function
     
' Converts a number from 1 to 9 into text. 
Function GetDigit(Digit)
    Select Case Val(Digit)
        Case 1: GetDigit = "One"
        Case 2: GetDigit = "Two"
        Case 3: GetDigit = "Three"
        Case 4: GetDigit = "Four"
        Case 5: GetDigit = "Five"
        Case 6: GetDigit = "Six"
        Case 7: GetDigit = "Seven"
        Case 8: GetDigit = "Eight"
        Case 9: GetDigit = "Nine"
        Case Else: GetDigit = ""
    End Select
End Function

How to use the SpellNumber sample function

To use the sample functions to change a number to written text, use one of the methods demonstrated in the following examples:

Method 1: Direct Entry

You can change 32.50 into "Thirty Two Dollars and Fifty Cents" by entering the following formula into a cell:
=SpellNumber(32.50)

Method 2: Cell reference

You can refer to other cells in the workbook. For example, enter the number 32.50 into cell A1, and type the following formula into another cell:
=SpellNumber(A1)

Method 3: Paste Function or Insert Function

To enter a custom function into a worksheet, you can use Paste Function in Excel 2000, or you can use Insert Function in Excel 2002 and in Excel 2003.

Excel 2000

To use Paste Function, follow these steps:
  1. Select the cell that you want.
  2. Click Paste Function on the Standard toolbar.
  3. Under Function category, click User Defined.
  4. Under Function name, click SpellNumber, and then click OK.
  5. Enter the number or cell reference that you want, and then click OK.

Excel 2002 and Excel 2003

To use Insert Function, follow these steps:
  1. Select the cell that you want.
  2. Click Insert Function on the Standard toolbar.
  3. Under Or select a category, click User Defined.
  4. In the Select a function list, click SpellNumber, and then click OK.
  5. Enter the number or cell reference that you want, and then click OK.

Saturday, February 5, 2011

Sent e-mail not showing up in the Sent Items folder


In Outlook click on Tools >>Options and then E-mail Options and uncheck the box next to "Save copies of messages in Sent Items folder" and and save your changes and exit Outlook using the File menu.
Restart Outlook and repeat the above process, this time putting the check back into the box you unchecked and save your changes.
Sent Items should now start appearing in your "Sent Items" folder again.

Tuesday, February 1, 2011

Error: 0x8004010F, Object could not be found


Problem: While doing a Send/Receive you see the error message: Task 'Microsoft Exchange Server' reported error (0x8004010F): 'The operation failed. An object could not be found.'

This error message indicates that MS Outlook was not able to find and download the offline Address Book. The offline Address Book for your company is automatically created during the first night after your company has signed up and become our customer.

Solution: This is a common error message that occurs on the first day that a user joins our service and does not affect your ability to send or receive email. This error will not be present the next day and does not require any action from the user.

If you continue to see this error message after the first 2-3 days of signing up as a new customer, please follow this sequence of steps:

Step 1: From within Outlook click Tools -> Send/Receive -> Download Address Book -> Ok.

If you still receive this error message when sending or receiving please proceed to Step 2.

Step 2: Rebuild your offline files:

  1. Go to C:\Documents and Settings\YourLoginName\Local Settings\Application Data\Microsoft\Outlook and create a folder called tmp.
  2. Move all of the files located into this folder.
  3. Start Outlook and be patient as it regenerates a copy of your mailbox
  4. Once you get the message "All folders are up to date" at the bottom right, try the send and receive
If you still receive this error message when sending or receiving please proceed to Step 3.

Step 3: Create a new profile for Outlook. Once the new profile is created, log in to the mailbox and wait for it to completely synch

Exchange 2007 Customers: If you are getting the following error message when attempting to perform synchronization in Outlook 2007:

"Not downloading Office address book files. A server (URL) could not be located or the error 0x8004010F Object could not be found."

Please ensure that the AutoDiscovery DNS record is created for your domain. Outlook 2007 utilizes the AutoDiscovery service to obtain the information on where Offline Address Book is located.