Staff member user account creation script

Powershell, Windows
Sharing is caring, right? Here is a powershell script I wrote that creates new users based on their First name and surname, checks to see if a username exists from their first name in AD, if it does append the first letter from their surname and use that as their username, if that exists, append the next letter, etc. I also have logic to set and create the user's home drive, add the account to the correct security groups, create a remote mailbox, begin a delta sync on Azure AD Connect, log to a text file for audit purposes and print off a word document to pass on details to new user. #New Staff Account Creation Script, Created by NCK - Last Revised 14/05/2018 #DECLARED VARIABLES $Colours = "Boris", "Doris",…
Read More
Can’t connect to SQL instance using Windows Authentication

Can’t connect to SQL instance using Windows Authentication

Windows
I had an odd issue at work where I could not connect to a SQL server using Windows authentication even though I had the authentication set to mixed mode. I was able to logon with the SQL authentication details but not with Windows authentication. I was presented with the following message - "The target principal name is incorrect. Cannot generate SSPI context." When looking into this it turned out that the SPNs were registered to a user object that did not run the service on the host of where the SQL Server was running. I use service accounts for SQL server, this one named SCCM-SQLSRV and this did not have the SPNs registered to it. To find out the user object/computer object that the SPNs are registered to you must…
Read More