• Windows 2008 / R2 排程執行bat檔時,出現錯誤代碼 0x1

    問題描述:

    Windows 2008 / R2 直接執行bat檔可以正常執行,透過排程就無法執行,出現錯誤代碼 0x1

    解決方法:

    當您設定排程內容有以下類型時,

    1. Win32 applications

    2. Win16 applications

    3. OS/2 applications

    4. MS-DOS applications

    5. batch files (*.bat)

    6. command files (*.cmd),

     

    建議您以下方式設定排程:

    1. 以 [建立工作] [create task] (非精靈模式) 來建立排程工作。

    2. 於 [一般] 標籤頁位置下方 [設定],設定以 “Windows Server 2003, Windows XP, or Windows 2000”  來執行。

    此設置,主要是”向下相容” (Backward Compatible ),當您以此設定來執行task scheduler時,就會以task scheduler1.0模式來執行:

    (這與目前2008 / R2的task scheduler 2.0 模式不同,詳細內容請參考下方說明)

    clip_image002

    3. 若是一般排程內容,你可以依照 [建立基本工作] (依照操作精靈指示) 逐步設定您需要的排程工作內容。

    參考資料:

    Task Scheduler Backward Compatible Tasks

    http://technet.microsoft.com/en-us/library/dd315694(WS.10).aspx

    A backward compatible task is a Task Scheduler 1.0 task that is used in the Windows XP, Windows Server 2003, and Windows 2000 operating systems. A Task Scheduler 1.0 task can be registered (scheduled) to execute any of the following application or file types: Win32 applications, Win16 applications, OS/2 applications, MS-DOS applications, batch files (*.bat), command files (*.cmd), or any properly registered file type.

    You can register a Task Scheduler 1.0 task in one of three ways:

    A. Use the schtasks.exe command-line tool to define and register a version 1.0 task.

    B. Use Task Scheduler to define and register a task compatible with earlier operating systems. Click the Create Task action in Task Scheduler, set the Configure for box on the General tab to Windows Server 2003, Windows XP, or Windows 2000.

    C.  Use Task Scheduler to import a Task Scheduler 1.0 task from an XML file.

    Task Scheduler 2.0

    http://msdn.microsoft.com/en-us/library/bb756979.aspx

    Task Scheduler

    http://msdn.microsoft.com/en-us/library/aa383614(VS.85).aspx

  • Windows 2003 Server 排程執行出現錯誤代碼 0x1

    問題描述:

    Windows 2003 Server 排程執行時出現錯誤代碼 0x1,同時排程執行狀態停在 [執行中],並未正常結束

    解決方法:

    建議啟用[允許服務與桌面互動]的設定:

    方法如下

    1. 依序按一下 [開始][控制台],再按兩下 [系統管理工具]

    2. 按一下 [電腦管理]

    3. 展開 [服務及應用程式],然後按一下 [服務]

    4. 用滑鼠右鍵按一下 [Task Scheduler] 服務,再按一下 [內容]

    5. 在 [一般] 索引標籤上,確定已將啟動類型設為 [自動],且服務狀態亦設為 [已啟動]。服務如未執行,請按一下 [啟動]

    6. 在 [登入] 索引標籤上,確定選取了本機系統帳戶,並核取了 [允許服務與桌面互動]核取方塊。

    7. 按一下 [確定],然後結束 [電腦管理]。

    clip_image001

    clip_image002

    參考資料:

    如何疑難排解 Windows XP 與 Windows Server 2003 中的排程工作

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

  • How to migrate CA from Server 2003 to Server 2008 R2 – Part I Backup CA & Uninstall CA Service on Source Server

    本系列包含四大部份 , 相關連結如下

    How to migrate CA from Server 2003 to Server 2008 R2 – Part I Backup CA & Uninstall ...

    How to migrate CA from Server 2003 to Server 2008 R2 – Part II Install CA Role on Destin ...

    How to migrate CA from Server 2003 to Server 2008 R2 – Part III Restore CA on Destinatio ...

    How to migrate CA from Server 2003 to Server 2008 R2 – Part IV Post-Migration Tasks

    Part I

    1. 開啟CA管理畫面並對CA名稱點右鍵 - All Tasks – Back up CA
    clip_image001

    2. 點選Next
    clip_image002

    3. 勾選上面兩個選項並選擇備份要存放的資料夾 (該資料夾裡面必須是空的)
    clip_image003

    4. 輸入一組密碼,還原CA時使用
    clip_image004

    5. 點選Finish完成程序
    clip_image006

    6. 開啟Regedit並找到底下機碼 , 將其匯出成CAConfig.reg
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\CertSvc\Configuration
    clip_image007

    7. 確認CA Server是否有C:\windows\CAPolicy.inf此檔案 , 有得話請將其備份  
    clip_image008

    8. 將C:\windows\system32\Certsrv\此資料備份起來

    9. 備份目前發佈的憑證範本資訊 , 以便後續Migration完成後可以將其發佈使用 (適用Enterprise CA)
        執行certutil -catemplates > CATemplates.txt
        image

       文字檔內的範本資訊則是目前可供User使用的憑證範本 (後面的錯誤訊息不用理會)

       image

     

    10. 將底下檔案複製到目的端Server

    • CA Backup Folder
    • CAConfig.reg
    • CAPolicy.inf
    • C:\windows\system32\Certsrv\CertEnroll
    • CATemplates.txt

    11. 上述動作都完成後 , 將來源Server的CA Service進行移除動作

    12. 打開新增移除程式 – 新增移除元件 , 取消勾選Certificate Services , 然後等候移除完成重新開機即可
    PS:移除CA元件時會將AD資料庫Configuration裡面的CA資訊也移除,所以此動作不能在Migration完成後才進行,會造成CA運作異常
    clip_image001[1]

  • How to migrate CA from Server 2003 to Server 2008 R2 – Part II Install CA Role on Destination Server

    本系列包含四大部份 , 相關連結如下

    How to migrate CA from Server 2003 to Server 2008 R2 – Part I Backup CA & Uninstall ...

    How to migrate CA from Server 2003 to Server 2008 R2 – Part II Install CA Role on Destin ...

    How to migrate CA from Server 2003 to Server 2008 R2 – Part III Restore CA on Destinatio ...

    How to migrate CA from Server 2003 to Server 2008 R2 – Part IV Post-Migration Tasks

     

    Part II

    PS:
    - 進行此動作前請確認Server電腦名稱已經修改完成並加入網域 , 否則安裝CA服務後無法重新更名
    - 如果先前有使用CAPolicy.inf時,請將來源端Server的CAPolicy.inf放至C:\windows底下

    1. 開啟Server Manager並點選新增角色
    clip_image002

    2. 點選下一步
    clip_image004

    3. 勾選Active Directory憑證服務
    clip_image006

    4. 點選下一步
    clip_image008

    5. 勾選憑證授權單位 & 憑證授權單位網頁註冊
    出現底下視窗後按下新增所需的角色服務同時安裝IIS
    clip_image010

    6. 選擇[企業]
    clip_image012

    7. 選擇[根CA]
    clip_image014

    8. 選擇[使用現有的私密金鑰] – [選取憑證並使用它的相關私密金鑰]
    clip_image016

    9. 選擇匯入並選擇先前備份的私鑰 & 輸入密碼
    (此檔案於先前備份CA所在的資料夾內)
    clip_image018

    10. 點選下一步
    clip_image020

    11. 使用預設設定 (此設定需跟來源CA的位置一樣)
    clip_image022

    12. 點選下一步安裝IIS元件
    clip_image024

    13. 使用預設設定即可 , 下一步
    clip_image026

    14. 點選安裝
    clip_image028

    15. 安裝完成後點選關閉
    clip_image030

  • How to migrate CA from Server 2003 to Server 2008 R2 – Part III Restore CA on Destination Server

    本系列包含四大部份 , 相關連結如下

    How to migrate CA from Server 2003 to Server 2008 R2 – Part I Backup CA & Uninstall ...

    How to migrate CA from Server 2003 to Server 2008 R2 – Part II Install CA Role on Destin ...

    How to migrate CA from Server 2003 to Server 2008 R2 – Part III Restore CA on Destinatio ...

    How to migrate CA from Server 2003 to Server 2008 R2 – Part IV Post-Migration Tasks

     

    Part III

    1. 開啟CA管理畫面進行還原CA動作
    clip_image001

    2. 還原CA時會先停止CA服務 , 按確定
    clip_image002

    3. 開始後點選下一步
    clip_image004

    4. 勾選兩個選項並選擇備份的資料夾
    clip_image005

    5. 輸入先前備份時設定的密碼
    clip_image006

    6. 點選完成
    clip_image007

    7. 點選是啟動CA服務
    clip_image008

    8. 用Notepad開啟先前備份的CA機碼檔案
    clip_image009

    編輯CAServerName的值(如果Server名稱一樣則不需要進行更改)    
     clip_image011
    如果原先是使用Standalone CA , 然後轉到Server 2008 R2要使用Enterprise CA時 , 需修改CAType的值成0
    修改完成後點兩下匯入, 匯入後請將Certificate Service進行重新啟動的動作讓其生效
    image

    CAType值的意義
    =============
    CAType = 0 (This means it is installed as Enterprise Root CA)
    CAType = 1 (This means it is installed as Enterprise Subordinate CA)
    CAType = 3 (This means it is installed as Stand Alone CA)
    CAType = 4 (This means it is installed as Stand Alone Subordinate CA)

     

    9. 將Source Server的C:\windows\system32\Certsrv\CertEnroll裡面的SourceServerName.domain.com_CAName(X).crt檔案
    複製到目的端Server的C:\windows\system32\Certsrv\CertEnroll資料夾內 (如下圖 , server2003是Source Server , 08r2-wins是Destination server)
    image