Skip to content
This repository has been archived by the owner on Oct 4, 2019. It is now read-only.

WinRM and vmWare Example for New Comers #184

Closed
LukB4ULeap opened this issue Nov 25, 2015 · 5 comments
Closed

WinRM and vmWare Example for New Comers #184

LukB4ULeap opened this issue Nov 25, 2015 · 5 comments

Comments

@LukB4ULeap
Copy link

Any Example of a Full Fledged working WinRM for Windows using vmware would be great for start. Do we have one as a starting point?. My attempt in doing this resulted in VMware giving a weird Canceled Error for whatever reason.
win7.docx

@Real2014
Copy link

Where can I find the configure-winrm.ps1 File?

@LukB4ULeap
Copy link
Author

I found this one online

Supress network location Prompt

New-Item -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Network\NewNetworkWindowOff" -Force

Set network to private

$ifaceinfo = Get-NetConnectionProfile
Set-NetConnectionProfile -InterfaceIndex $ifaceinfo.InterfaceIndex -NetworkCategory Private

Set up WinRM and configure some things

winrm quickconfig -q
winrm s "winrm/config" '@{MaxTimeoutms="1800000"}'
winrm s "winrm/config/winrs" '@{MaxMemoryPerShellMB="2048"}'
winrm s "winrm/config/service" '@{AllowUnencrypted="true"}'
winrm s "winrm/config/service/auth" '@{Basic="true"}'

Enable the WinRM Firewall rule, which will likely already be enabled due to the 'winrm quickconfig' command above

Enable-NetFirewallRule -DisplayName "Windows Remote Management (HTTP-In)"

sc.exe config winrm start= auto

exit 0

@Real2014
Copy link

Thanks, i will try out :)

@joefitzgerald
Copy link
Owner

#181

@LukB4ULeap
Copy link
Author

Joe
Can I get a full working example of Packer Win 7 with vmware and winRM I have been struggling since time immemorial. I get "waiting for WinRM availability" and after a few hours Timesout. Wonder what's wrong in my sequence. Here is the full sample
{
"variables": {
"iso_path": "./iso/en_windows_7_ultimate_with_sp1_x64_dvd_u_677332.iso",
"iso_md5": "C9F7ECB768ACB82DAACF5030E14B271E"
},

"builders": [
    {
        "type": "vmware-iso",
        "communicator": "winrm",
        "disk_size": 61440,
        "floppy_files": [
            "Autounattend.xml",
            "update-windows.ps1"
        ],
        "guest_os_type": "windows7-64",
        "headless": false,
        "iso_url": "{{user `iso_path`}}",
        "iso_checksum_type": "md5",
        "iso_checksum": "{{user `iso_md5`}}",

        "winrm_username": "Administrator",
        "winrm_password": "Packer",
        "boot_wait": "2m",
        "winrm_port": "5985",
        "winrm_timeout": "6h",

        "shutdown_command": "shutdown /s /t 10 /f /d p:4:1 /c \"Packer Shutdown\"",
        "skip_compaction": false,
        "vmx_data": {
            "gui.fitguestusingnativedisplayresolution": "FALSE",
            "memsize": "4096",
            "numvcpus": "1",
            "virtualHW.version": "10",
            "scsi0.virtualDev": "lsisas1068"
        }
    }

],
"provisioners": [
    {
        "type": "powershell",
        "execute_command": "powershell -ExecutionPolicy Bypass \"& { {{.Vars}}{{.Path}}; exit $LastExitCode}\"",
        "scripts": [
            "install-guest-tools.ps1",
            "enable-rdp.ps1",
            "disable-hibernate.ps1",
            "disable-autologin.ps1",
            "enable-uac.ps1"
        ]
    }
]

}
OUTPUT
==> vmware-iso: Downloading or copying ISO
vmware-iso: Downloading or copying: file:///D:/Symantec/MyDevelopment/PV-Demo/Packer-Vagrant%20Step%20by%20Step/ISO/en_windows_7_ultimate_with_sp1_x64_dvd_u_677332.iso
==> vmware-iso: Creating floppy disk...
vmware-iso: Copying: Autounattend.xml
vmware-iso: Copying: update-windows.ps1
==> vmware-iso: Creating virtual machine disk
==> vmware-iso: Building and writing VMX file
==> vmware-iso: Starting virtual machine...
vmware-iso: The VM will be run headless, without a GUI. If you want to
vmware-iso: view the screen of the VM, connect via VNC without a password to
vmware-iso: 127.0.0.1:5964
==> vmware-iso: Waiting 2m0s for boot...
==> vmware-iso: Connecting to VM via VNC
==> vmware-iso: Typing the boot command over VNC...
==> vmware-iso: Waiting for WinRM to become available...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants