Skip to main content

Using PowerShell to set up Automatic Login on Windows Servers

· 2 min read

Some server based applications require to be logged into a service account to allow an Application or service to run, These applications usually require manual intervention by systems administrators to login to the account manually after a server restart.

There are many ways to setup Automatic Logon, using “control userpasswords2” via the Run Prompt, using Third Party utilities like LogonExpert or_ Sysinternals Autologon for Windows  _this simply using RegEdit and setting them manually.

I have created a PowerShell script for editing the registry to set this manually in a standardized way and could be run remotely. It is pretty simple and only requires version 1 of PowerShell.

#authors: [Luke] Murray (Luke.Geek.NZ) #Version: 0.1 #Purpose:

#The purpose of this PowerShell script is to set the AutoLogon and WinLogon registry strings using PowerShell, to setup a Windows Server #or Workstation for Automatic Logon. #The $UserName and $Password variables need to be configuration for your environment. Please make sure the $UserName variables follows #DOMAINNAME\SAMACCOUNTNAME format. #This needs to be ran using an Elevated PowerShell ISE or PowerShell window (with Admin access on the computer you are running this on).

$usrname = 'DOMAINNAME\SAMACCOUNTNAME' $password = 'PASSWORD' $RegistryLocation = 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon' Set-ItemProperty $RegistryLocation -Name 'AutoAdminLogon' -Value '1' Set-ItemProperty $RegistryLocation -Name 'DefaultUsername' -Value "$usrname" Set-ItemProperty $RegistryLocation -Name 'DefaultPassword' -Value "$password"

Note: Also note following this method, the username and password are not encrypted and stored as plain text in the registry.

How to install .NET Framework 3.5 on Windows Server 2012 and Windows Server 2012 R2

· One min read

.NET Framework 3.5 needs the source files off the Windows Server 2012 DVD in order to install. You can do this online and without needing a restart using DISM.

1. Go to a command prompt and enter this:

dism /online /enable-feature /featurename:NetFX3 /all /Source:d:sourcessxs /LimitAccess

Note: Source should be the Windows DVD location, ie d: /Source:x if x is your DVD mount point.

How to configure Active Directory delegation to allow users to move computers between OUs

· One min read
  1. Open Active Directory Users & Computers with AD rights
  2. Right click on the organisation unit you want to give access to and click Delegate Control
  3. Add the group want to give this access to, for example “"IT HelpDesk"
  4. Select “Create a custom task to delegate” and click Next
  5. Select "Only the following objects in this folder"
  6. Check "Computer Objects"
  7. Check "Create selected objects in this folder"
  8. Check "Delegate selected objects..." and click Next
  9. Make sure Write is checked and click Next
  10. Click Finish

Repeat steps 2 to 10 again on other OUs you would like to delegate move rights to.