Delete files that you don’t have permissions too.

I was running into a issue where i wasn’t able to delete a directory in Windows Explorer or in PowerShell and i go this pesky message Image with the remove-item cmdlet. It was a file on a file server that i was full enterprise admin on! So I thought i would share my easy method to get rid of files and folders that you do not have said permissions for.

Steps:

1) Create a folder called “Windows.old”

2) Move files that cannot be deleted into that folder

3) Run Disk Cleanup in Start – All Program – Accessories – System Tools (or Search in the Start menu)

4)Choose the drive where the Windows.old file is located and click OK

5) Check the “Previous Windows Installations” box and click OK

Done!

Note that you can also Rename the Folder you want to delete to “Windows.old” instead of making a new folder

Advertisements

Install/Remove Server 2012 GUI

One of the best improvements with Windows Server 2012 was the ability to switch from a full server GUI to Core and back and forth between them. For instance, lets say you install a RODC with a full GUI and then decide that you want to manage that RODC remotely using remote management tools. With Server 2012 you are able to drastically decrease your attack surface area by removing the GUI. It also decreases your vulnerability and maintenance since many of the Windows Updates are patches for the GUI. You can of course do this through the GUI of your central management server with the Add/Remove server features but Powershell is way more fun!

To remove the GUI 

Step 1: Enable Remote Administration

Configure-SMRemoting.exe –Enable

This will enable remote administration.

Step 2: Uninstalling the GUI

Uninstall-WindowsFeature Server-Gui-Mgmt-Infra, Server-Gui-Shell –Restart (Also using “–Remove” actually removes the underlying binaries)

To reverse your actions and install the GUI use the below commands.

To install the GUI: 

Install-WindowsFeature Server-Gui-Mgmt-Infra,Server-Gui-Shell –Restart

This will will install the GUI and restart the server. It is literally that easy! Now if you want to keep a GUI just in case but you don’t need a full feature OS Server 2012 also has a minimalist GUI. Use this command to install the minimal interface from a core installation

Install-WindowsFeature Server-Gui-Mgmt-Infra

Install Domain Controller 2012 with Powershell

Step 1: Install Active Directory Domain Services

Install-windowsfeature -name AD-Domain-Services

If using a server with a GUI add “-IncludeManagementTools” to the end of the above line.

Step 2:

Import -Module ADDSDeployment

Install -ADDSDomainController `
-NoGlobalCatalog:$false `
-CreateDnsDelegation:$false `
-Credential (Get -Credential) `
-CriticalReplicationOnly:$false `
-DatabasePath “C: \Windows \NTDS” `
-DomainName “nuggetlab.com” `
-InstallDns:$true `
-LogPath “C: \Windows \NTDS” `
-NoRebootOnCompletion:$false `
-SiteName “Default -First -Site -Name” `
-SysvolPath “C: \Windows \SYSVOL” `
-Force:$true