Build(Customize) Windows QEMU Guest Agent

參考資料:

https://wiki.qemu.org/Hosts/W32

http://www.cnblogs.com/silvermagic/p/7666143.html

  1. Prepare(Install) Fedora 26 Virual Machine
  2. Prepare mingw64 envionment
    yum install mingw64-pixman mingw64-glib2  mingw64-gmp mingw64-SDL mingw64-pkg-config
    yum install mingw64-winpthreads-static
  3. Download VSS SDK
    http://www.microsoft.com/en-us/download/details.aspx?id=23490
    from QEMU source

    ./qemu/scripts/extract-vsssdk-headers setup.exe
  4. Download and build from QEMU source
    git clone https://github.com/qemu/qemu
    cd qemu
    git submodule update --init dtc
    ./configure --enable-guest-agent --cross-prefix=x86_64-w64-mingw32- --with-vss-sdk=/root/vss
    make msi -j
    
  5. Copy qemu-ga-x86_64.msi to Windows VM and install it.
  6. Test query VM IP from KVM Host.
    virsh
    list (Get VM Name or ID)
    qemu-agent-command <Name or Id> '{"execute":"guest-info"}'
    qemu-agent-command <Name or Id> '{"execute":"guest-network-get-interfaces"}'

 

 

 

 

 

 

Download: qemu-ga-x86_64(v2.10.50)

幾個Windows 2008R2/Windows7可以設定proxy的位置

今天在幫客戶查WSUS無法使用問題時發現有可能是SID衝到需要sysprep調整SID,不過sysprep改完SID後仍無法WSUS?
透過netstat -na -p tcp指令持續觀察Windows update時的網路流量一直被導向到proxy

把下面相關的proxy設定移除即可 (Windows可以設定proxy的位置)

  1. Internet Explorer
    • 工具->網際網路選項->連線->區域網路設定->Proxy伺服器
  2. gpedit.msc
    • 使用者設定->Internet Explorer維護->連線->Proxy設定值
  3. netsh winhttp get proxy (很容易被忽略的地方)

Windows 2008 R2 sysprep 自動化

參考資料:
How to Sysprep in Windows Server 2008 R2 and Windows 7

The Complete Guide to Preparing a Windows 7 Deployment Image using Audit Mode and Sysprep with an unattend.xml Answer File

 

基本上照著reference裡link這幾位高手的SOP跑一遍大概就OK了

幾個重點紀錄一下

  1. 要準備好windows 2008 r2 的source光碟 (裡面的/source/install.wim這個檔案 WAIK要用到)
  2. 將source光碟中的/source/install.wim (約2.7Gb)複製到硬碟 (複製完後把install.wim唯讀屬性移除)
  3. 下載並安裝Windows Automated Installation Kit (WAIK)

unattend.xml範例
目的一:自動化sysprep (全自動執行不跳出需要人工點選畫面)
目的二:修改administrator預設密碼(改成Passw0rd)

<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend">
    <settings pass="generalize">
        <component name="Microsoft-Windows-OutOfBoxExperience" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
            <DoNotOpenInitialConfigurationTasksAtLogon>true</DoNotOpenInitialConfigurationTasksAtLogon>
        </component>
        <component name="Microsoft-Windows-ServerManager-SvrMgrNc" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
            <DoNotOpenServerManagerAtLogon>true</DoNotOpenServerManagerAtLogon>
        </component>
    </settings>
    <settings pass="oobeSystem">
        <component name="Microsoft-Windows-International-Core" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
            <InputLocale>zh-TW</InputLocale>
            <SystemLocale>zh-TW</SystemLocale>
            <UserLocale>zh-TW</UserLocale>
            <UILanguage>zh-TW</UILanguage>
        </component>
        <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
            <OOBE>
                <HideEULAPage>true</HideEULAPage>
            </OOBE>
            <UserAccounts>
                <AdministratorPassword>
                    <Value>UABhAHMAcwB3ADAAcgBkAEEAZABtAGkAbgBpAHMAdAByAGEAdABvAHIAUABhAHMAcwB3AG8AcgBkAA==</Value>
                    <PlainText>false</PlainText>
                </AdministratorPassword>
            </UserAccounts>
        </component>
    </settings>
    <cpi:offlineImage cpi:source="catalog:d:/sources/install_windows server 2008 r2 serverstandard.clg" xmlns:cpi="urn:schemas-microsoft-com:cpi" />
</unattend>