Creating my Lab domain using PowerShell

This is a script I use to Create a simple domain for lab purposes

net user administrator P@ssw0rd

Rename-Computer DC1

Install-WindowsFeature AD-Domain-Services -IncludeManagementTools

import-Module ADDSDeployment

$param = @{'CreateDnsDelegation'=$false;










Install-ADDSForest @param -SafeModeAdministratorPassword (convertTo-SecureString -AsPlainText "P@ssw0rd" -Force )

Posted in AWS

Using PowerShell to start EC2 windows Instance with a data file

This script assumes that you downloaded and installed the AWS PowerShell tools and you have access keys.

Start by creating a data file. I am using a PowerShell block that I am calling c:\temp\dataFile.txt which contains the following text.

net user administrator P@ssw0rd

Set-AWSCredentials -AccessKey AXXXXXXXXXXXXXXXXXX -SecretKey OXXXXXXXXXXXXXXXXfffffffffffffff
New-EC2Instance -ImageId ami-b6af04a0 -MinCount 1 -MaxCount 1 -InstanceType t2.nano -SecurityGroupid 'sg-fffffffff' -Region us-east-1 -SubnetId subnet-9999999 -AssociatePublicIp $true -KeyName mypem -UserDataFile C:\temp\dataFile.txt -EncodeUserData