script

Applying Windows, System, and Recovery Partitions by using a Deployment Script

Applies To: Windows 8, Windows 8.1, Windows Server 2012, Windows Server 2012 R2

Automating Sysprep File Transfer to vCenter

Original article can be found here: http://blogs.vmware.com/PowerCLI/2014/06/automating-sysprep-file-transfer-vcenter.html

I was at my local Salt Lake City VMware User Group (VMUG) last week doing a Q&A when one of the users mentioned it is painful to only be able to upload one Sysprep file at a time to vCenter. I wanted to take the time to address this for him as well as any of you who may have the same issue.

Starting and Stoping a Powershell Script as a Job

You may start your script as a job.

start-job -scriptblock {. Pathofyourscript.ps1}

Then stop the job if CTRL+C is pressed:

[console]::TreatControlCAsInput = $true
while ($true) {

     Start-Sleep -s 30

     if ([console]::KeyAvailable) {

         $key = [system.console]::readkey($true)
         if (($key.modifiers -band [consolemodifiers]"control") -and ($key.key -eq "C")) { "Terminating..." }

    } 

        get-job | stop-job

        break
   }
    }
}

Powershell script termination examples

function Close-Script {
    #If stream1 is created
    if($stream1) { 
        $stream1.Close()
    }

    #Terminate script
    exit
}

$stream1 = New-Object System.IO.StreamWriter filename.txt


If(a test that detects your error) {
    Close-Script
}


Remotely disable IPv6 with PowerShell

$adminUser = "DOMAIN\USERNAME"

Deploy Office with a script assigned by a Group Policy

Configure the installation script as a computer startup script by using Group Policy

After you test the installation script, do the following:

vCenter Operations Manager script error fix

Using MAK Activation

MAK activation is used for one-time activation through Microsoft’s hosted activation services, with no renewals required. For background information about MAK activation, see the Volume Activation 2.0 Planning Guide at http://technet.microsoft.com/en-us/library/cc303276.aspx.

Subscribe to RSS - script