Unable to get password for Instance launched from AMI obtained from an instance after being shutdown from SysprepInstance.ps1 for AWS Windows 2016 - powershell

I read through how to work with Ec2Launch and SysPrep with AWS Windows 2016. Unlike 2008 R2 or 2012 R2, 2016 does not use the EC2ConfigService, instead it has EC2Launch and bunch of PowerShell scripts which takes care of the EC2ConfigService's job.
I launched a windows instance call it "I1" from the community AMI - Windows_Server-2016-English-Full-Base-2017.03.15
I Scheduled InitializeInstace.ps1, command - powershell.exe -Command "C:\ProgramData\Amazon\EC2-Windows\Launch\Scripts\InitializeInstance.ps1 –Schedule"
I ran SysprepInstance.ps1, command - powershell.exe -Command "C:\ProgramData\Amazon\EC2-Windows\Launch\Scripts\SysprepInstance.ps1"
The instance goes from running state to stop state.
I take an AMI of the instance and launch another Instance "I2".
There are two issues I am facing:
Issue 1 - I am not able to RDP into instance I1, I tried the password from the console by decrypting it with my pem file. But that password works fine before I have run this SysprepInstance.ps1, but after running that script I get the error Password incorrect.
Issue 2 - Once my Instance I2 has passed the status checks and is running, when I try to connect to it and retrieve the password from the console, I am not able to retrieve it, it gives me the error:
Please wait at least 4 minutes after launching an instance before trying to retrieve the auto-generated password.
In case of Windows 2008 R2 or 2012 R2, we would change the config.xml file of EC2ConfigService and make EC2SetPassword to enabled, but I'm not understanding what am I supposed to do with Windows 2016 with EC2Launch.
Edit 1: Including the contents of LaunchConfig.json
{
"setComputerName": false,
"setWallpaper": true,
"addDnsSuffixList": true,
"extendBootVolumeSize": true,
"adminPasswordType": "Random",
"adminPassword": ""
}

Related

Writing to Application Log on a remote Windows 7 machine

I need to write to an application log on a remote Window 7 computer. When my PC was running Windows 7, I could do so using a Write-Entry cmdlet, eventcreate, WriteEvent API, or LogEvent in VBS. Since upgrading my PC to Windows 10 (v1511), this no longer works failing with an error "The procedure number is out of range". I can write to an application log on a remote Window 10 machine, but the problem is with the remote (not firewalled) Window 7 PC. How can this problem be solved?

.exe Program Run Automation in Windows 2012

I have a Exe program which run fines and update the log when I run it manually or create a batch script run the .bat file (By double click/call from CMD prompt).
When I am trying to automate this process by creating scheduled task/ creating a service it don't work.
In Windows 2012 Srvany.exe also dont work so i am not able to create a service , even though I create a service using SC Create command the service fails to run in windows 2012.
I got the answer- This was happening as My Program was not running at Interactive mode,As per Microsoft a task runs at Interactive mode when "Run when User logged on" option is chosen, if we choose other option the program will not run at interactive mode.
https://technet.microsoft.com/en-us/library/cc722152.aspx

SQL Server VSS Writer refuses to start

I've got Visual Studio 2012 installed on Windows 7 64 bit machine. I am trying to install SQL Server express LocalDB and get an error when the installer tries to start services. Here is the exact error message:
Service 'SQL Server VSS Writer' failed to start. Verify you have sufficient privileges to start system services.
I am logged on to the machine as administrator. I have verified that the writter in Services is running and it is set to Auto.
I have no SQL Server installed on this machine as far as I know.
I'm stumped. Anyone have any ideas?
Also when I try to start SQL Writer in Services I get the following error:
Windows could not start the SQL Server VSS Writer service on local computer.
Error 1053: The server did not respond to the start or control request in a timely fashion.
Thanks to Process Explorer, we can see there's a missing MSVCP140.dll when the service is trying to start (and failing) :
The solution is to install the Visual C++ Redistributable for Visual Studio 2015 :
https://www.microsoft.com/en-us/download/details.aspx?id=48145
Have you tried below URL, we need to give User particular rights
http://technet.microsoft.com/en-gb/library/cc794944(v=ws.10).aspx

Changing the 'Server Collation' after installation

I want to change the Server Collation of SQL Server 2008 R2
As all opinions says (including MSDN) the following command should be executed:
E:\setup.exe /q /ACTION=RebuildDatabase /INSTANCENAME=MSSQLSERVER /SAPWD=”**″ /SQLSYSADMINACCOUNTS=”HEREISMYPROBLEM” /SqlCollation=SQL_Latin1_General_CP1_CI_AS
As I Pointed, my problem is with the SYSADMINACCOUNT paremeter because the error that I get is:
The Windows account ”blablabla” does not exist and cannot be provisioned as a SQL Server system administrator.
I tried all possible windows accounts that may be, but It's not working.
Please can you guide me how to know my correct windows account.
The MSDN link that shows this problem is
here
This page describes the switches and says to use "DOMAIN\User" format, for example:
BUILTIN\Administrators MyDomain\MyUser
For anyone else that gets stuck with this problem and cant find an answer. The commands work you just need to run cmd as an administrator for it to work.
Use this batch file for change collation on SQL Server 2008
But you need edit batch file for set you instance and target collation.
Stop SQL Server Service when you run this file
File need Run as administrator
If don't work well (maybe access problem), you can use cmd (Run as admin) and run batch file steps on cmd

Execute a remote process on a non-admin account using Powershell

I want to run aa remote process (winword.exe more specifically) from a remote machine using Powershell 2.0. One requirement is that the process is run by a non-admin user account. I'm able to run winword.exe if the user is part of the local administrator group on the remote machine, however when I remove it from the admin group, it fails - I get a winword.exe cannot be found error (32bit winword running on a 64bit 2008 server).
I've tried adjusting the PSSession configuration by granting the non-admin user account more elevated priveleges but it still fails:
Set-PSSessionConfiguration Microsoft.Powershell -ShowSecurityDescriptorUI
Is there something I'm missing here? Or does the user account explicitly require admin level priveleges on the server? Although PS tools would be a nice alternative, I would prefer using PS.
Have a look to the "Understanding Session Configurations" paragrph in the Administrator's guide to PowerShell Remoting from PowerShell.com.