How to automate the configuration process of Windows Server 2016? - powershell

I need to setup and configure some Windows Server 2016 VMs. The tasks include:
Execute c:\windows\system32\sysprep\sysprep\sysprep.exe
Configure the administrator password
Rename the guest VM
Set fixed IP address
Add it into a domain
Install some software in the VMs
Right now I have to do all the steps manually which is boring and error-prone. I can use PowerShell to automate some steps but some tasks require a reboot of the OS so I don't know whether it it possible to automate the whole process. Can someone point me in the right direction? I've heard of some configuration management tools like Ansible or Chef etc, but I don't have experience in those. Can they solve my problem?

Related

How to run eclipse on AWS

I have successfuly run rStudio on Amazon Web Services and it is extremely useful.
I want to run eclipse on AWS as well. When I type this in to google most tutorials are about the eclipse plugin. That's not what I want. I want to run eclipse on AWS.
I tried setting up an instance on EC2 which allowed me to run windows server 2012 but I couldn't install anything because of various internet explorer configuration issues and anyway I hat windows. I also tried a remote linux installation but its not really what I want. I want to run eclipse so that I can access it from a public DNS in the same way that I have managed to do with rStudio. Is this possible. Are there other (even non-AWS) ways?
I presume that by "AWS" you are actually referring to Amazon EC2 virtual machines.
Installing software on an Amazon EC2 instance is no different to installing on any other computer -- it's the same copy of Microsoft Windows you would use elsewhere.
The difficulties you mention of running Internet Explorer on Windows 2012 is entirely part of Microsoft's (rather strange) security settings that discourage using Internet Explorer as a system administrator, in order to combat security weaknesses that people try to exploit. Windows 2012 will no longer be supported by Microsoft in 2018.
I recommend using Windows 2016, which does not seem to impose such restrictions. It's also a newer, supported operating system that matches Windows 10.
Then, just install the software as normal and things will work a lot better for you.
Update:
You're right -- IE has problems on Windows 2016 but they are different to what is happening on Windows 2012 (last time I looked).
To get around the silly Microsoft IE security:
Run Server Manager
Go to Local Server
Click IE Enhanced Security Configuration ("On")
Turn both settings off
Internet Explorer then works and you can install Eclipse.

Best practice for uninstalling software with PowerShell

Like a lot of other applications out there the BlueJeans Desktop App MSI comes in two flavours: Per User MSI & Per Machine MSI.
Today, it is possible to have both installed on the same machine, but I have an increasing number of customers who have users with both installed and want to be able to clean it up. I have put together a cleanup script that handles uninstalling our application, but what I need to know from the community is whether I should utilize PowerShell to connect to each machine and run the script remotely or deploy the script via SCCM, IBM BigFix etc. to each machine and run the script locally?
A copy of my script can be found here: https://github.com/stuartminch/powershell/blob/master/cleanup_utility.ps1
If you have two separate MSI installers (User MSI & Per Machine MSI) the easiest way would be to use MSI {GUID} to uninstall them.
example msiexec.exe /x {GUID} /q
If you have them installed on a machine you can find uninstall string with GUID under
"HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall{GUID}\UninstallString
You can then configure it in SCCM.
Best practice would be to configure the deployment along with uninstall so if you deployed it through SCCM just add Uninstall commands there.

how to install operating system on a virtual machine programatically

It may be a duplicate question but i could not find it anywhere.
Anyway, my goal to install operating system(both linux and windows) programatically on a virtual machine running on vmware hosts.
Although my search, I am quite lost about where to start.
Is there a framework or project you can suggest?
You could use templates; i.e. create a VM, install the Linux distribution of your choice and make the VM a template. Then don't create VMs but deploy the template.
Alternatively, google for the Linux distribution of your choice and something like "network installation". You'll need a DHCP server and probably a TFTP and/or web server.
Working with Templates and Clones
Creating VMware Virtual Machine Templates
Try having a look at Vagrant: http://www.vagrantup.com/. It allows you to install/uninstall a predefined VM from the command line.

Automated deployment using VMware powercli

We are having build environment where we did not use any tools like Cruise control , TFS or buildforge.
We are purely depend upon Msbuild and powershell. We decided to automate the deployment process.
As we are using VMWare ESXi to meet our Virtual machine needs. We decided to use VMWare powercli to automate deployment process.
After build is over , VMware powercli will revert the snapshot of VM to fresh state and we tried using Invoke-VMScript to do automated deployment.
But as our deployment has UI , this is nearly impossible as Powercli try to invoke UI in session 0 and it doesn't support UI application.
Does any body overcome this problem and installed your application successfully in Virtual machine?
I have some experience in the area. I use PowerCLI and Windows Remote to get the job done. I have a machine with VMWare snapshot where windows remoting is activated and configured and then I use PowerCLI to revert to snapshot and power the machine on and then I call Invoke-Command. Not sure if it will survive the UI thing, but worth a try. First make sure that you can execute your task from PowerShell and if yes - then windows remouting will most probably be able to do it as well. You can read how to configure Windows Remouting here:
http://amarchuk.blogspot.com/2011/10/windows-remoting-and-powershell.html

Deploy files on a network share from a client machine using an installation package?

We have a large application that has been developed over 15 years and in installed in 200+ client locations. The application currently consists of an Access database and a bunch of executable and report files located on a network share. A Setup.EXE file is run on each client machine (dlls are installed on the client) and then the client machines run the executables directly from the network share. During our upgrade procedure the new executable and report files are copied to the network share and that way each client gets the update immediately.
Our current installation program is very old and, among other things, it doesn't handle x64 so we are in the process of moving to a new deployment tool. At the same time we are migrating client Access databases to SQL Server. I am having difficulty finding a deployment tool to do what we require. Specifically we need the install/upgrade file to do the following:
It must be able to be run from a client machine on a network and copy the new executable and report files to the network share. That share could be a Linux box or a dumb storage device.
Accept a password before running the installation
Allow the user to select the network share as the location to copy the executables
It must NOT add anything to the client machine from where the package is run (Add/Remove Programs, registry, etc.)
Connect to a SQL Server database and run a script
The install/upgrade must be contained in a single, standalone .msi or .exe file. (no dependencies on dlls or frameworks other than those that come with Windows XP)
The file must be able to be run in one simple step. It is the end user that runs the upgrade without our support and without involvement from IT.
It looks like the closest thing to what I need is WiX but the problem there is that whenever the .msi file is run from a client, the client machine thinks that a program is being installed so it allows the client machine to uninstall the product, which is not acceptable.
If the product were written today it would certainly be architected differently but it currently is what it is and we can’t change that. Any help here would be greatly appreciated!
WiX is just a toolset built on top of Windows Installer technology. It makes many things easier and simpler as well as hides lots of Windows Installer weird features... But, it is still limited by Windows Installer, its underlying technology.
Your list of requirements made me think that Windows Installer is not the right technology to choose. I would assume that you'll spend more time on workarounds, than on functional code... But I have no experience with other installation technologies, so I'll leave those recommendations to others.