Skip to content

Instantly share code, notes, and snippets.

$VMName = "PIXEL-SRV01"
[int64]$VMMem = 1MB*1024 #chnage to 1gb* the number of gb if you need.
$VMGen = "2"
$VHDPath = "V:\Hyper-V\$VMname\Virtual Hard Disks\$VMName.VHDX"
$VMPath = "V:\Hyper-V\"
[int64]$VMSize = 1GB*40
$ISOPath = "C:\ISO\en_windows_server_2016_x64_dvd_9327751.iso"
@PixelRobots
PixelRobots / Nano_IIS.ps1
Last active April 21, 2017 21:01
easy create iis site on nano server
Enter-PSSession -ComputerName PIXEL-NANO10
Import-Module iis*
New-IISSite -Name "TestPixels" -BindingInformation "*:80:" -physicalPath "c:\inetpub\wwwroot\TestPixels"
Enable-ADOptionalFeature "Privileged Access Management Feature" -Scope ForestOrConfigurationSet -Target pixelrobots.co.uk
Get-ADGroupMember "Domain Admins"
Add-ADGroupMember -Identity "Domain Admins" -Members "Ian" -MemberTimeToLive (New-TimeSpan -Minutes 30)
Get-ADGroup "Domain Admins" -Property member -ShowMemberTimeToLive
#changing PIXEL-DC01 to a name of the domain controller you want to push replication from.
Repadmin /syncall PIXEL-DC01 /APed
Enter-PSSession -ComputerName PIXEL-NANO10
Install-NanoServerPackage Microsoft-NanoServer-Storage-Package -Culture en-us
shutdown /r /t 10
Exit-PSSession
Enter-PSSession -ComputerName PIXEL-NANO10
New-Item -Name Share -Path c:\ -Type directory
New-SmbShare -Name share -Path c:\Share
Get-SMBShareAccess share
Grant-SmbShareAccess -Name share -AccountName ad.testpixels.co.uk\richard.hooper -AccessRight change
revoke-SmbShareAccess -Name share -AccountName everyone
Import-Module ActiveDirectory
Enable-ADOptionalFeature -Identity `
'CN=Recycle Bin Feature,CN=Optional Features,CN=Directory Service,CN=Windows NT,CN=Services,CN=Configuration,DC=pixelrobots,DC=co,DC=uk' `
-Scope ForestOrConfigurationSet -Target 'pixelrobots.co.uk'
Test-ADDSDomainControllerUninstallation -DemoteOperationMasterRole -RemoveApplicationpartitions
Uninstall-ADDSDomainController -DemoteOperationMasterRole -RemoveApplicationpartitions
Test-ADDSDomainControllerUninstallation -DemoteOperationMasterRole -RemoveApplicationpartitions
Uninstall-ADDSDomainController -DemoteOperationMasterRole -RemoveApplicationpartitions
#Find who has the FSMO Roles
netdom query fsmo
#Move FSMO Roles
Move-ADDirectoryServerOperationMasterRole -Identity PIXEL-DC03 -OperationMasterRole SchemaMaster, DomainNamingMaster, PDCEmulator, RIDMaster, InfrastructureMaster
#Check that the move went well
Netdom query fsmo
# Install ADDS and all management tools
Write-Host "Installing ADDS"
Add-WindowsFeature -Name “ad-domain-services” -IncludeAllSubFeature -IncludeManagementTools -verbose