Tips, Tricks, and Fixes for when your computer doesn't do what it's told.

Tuesday, March 25, 2008

Update Compact Framework Apps with Web Service

This link describes a method for automatically having Compact Framework applications update themselves on a device through a web service.

http://visualstudiomagazine.com/features/article.aspx?editorialsid=1323

Monday, March 24, 2008

Running CMD.EXE as Local system account

It can be useful to run the command shell under the Local System account. For example, a service that runs on the local system account needs a certificate installed; this could be performed by opening a cmd window as local system.

Create a .cmd file with the following contents:

sc delete testsvc
sc create testsvc binpath= "cmd /K start" type= own type= interact
sc start testsvc



http://blogs.msdn.com/adioltean/articles/271063.aspx

COM objects and ASP

Creating a spreadsheet from an ASP page requires referencing Excel as a COM object on the hosting IIS server. To format the page of the spreadsheet, Excel has to have printers installed, but this can be a problem when called from ASP.

The workaround is to setup printers for the SYSTEM account (which is the account that ASP runs under).

  1. Ensure that the user you are currently logged into on the server has the desired printers installed.
  2. Launch the Registry Editor (Regedit.exe).
  3. Select the following key: HKEY_CURRENT_USER
    \Software\Microsoft\Windows NT\Current Version\Devices
  4. From the Registry menu, click Export Registry File.
  5. In the File Name text box, type c:\Devices.reg.
  6. Select the following key: HKEY_CURRENT_USER
    \Software\Microsoft\Windows NT\Current Version\PrinterPorts
  7. From the Registry menu, click Export Registry File.
  8. In the File Name text box, type c:\PrinterPorts.reg.
  9. Select the following key: HKEY_CURRENT_USER
    \Software\Microsoft\Windows NT\Current Version\Windows
  10. From the Registry menu, click Export Registry File.
  11. In the File Name text box, type c:\Windows.reg.
  12. From the Start button, select Run. Open Devices.reg in Notepad by typing Notepad Devices.reg in Run dialog box.
  13. Replace the text HKEY_CURRENT_USER with HKEY_USERS\.DEFAULT
  14. Save the file. Then import it into the registry by double-clicking the file in Windows Explorer.
  15. Repeat steps 13 through 15 for PrinterPorts.reg and Windows.reg

http://support.microsoft.com/kb/184291