PowerShell: Prompt Has Changed To Two Greater Than Signs
Dec23

PowerShell: Prompt Has Changed To Two Greater Than Signs

KB ID 0001380 Problem What does this mean? Well it means you’ve either got something wrong, or missed something out, and PowerShell is not sat waiting for more input. Which is fine but in most cases you simply need to fix your syntax and sort again so how do you ‘escape’ back to the normal PowerShell prompt? Solution As you can see, (below) typing quit or exist does not help. You need to press CTRL+C. Related...

Read More
PowerShell: Restart Fails ‘Other Users Logged On’
Dec03

PowerShell: Restart Fails ‘Other Users Logged On’

KB ID 0001374 Problem If you intend to shutdown, or restart a remote computer using PowerShell, you may see the following error message; PS C:\> Restart-Computer “Computer-name” Restart-Computer : This command cannot be run on target computer(‘Computer-name’) due to following error: The system shutdown cannot be initiated because there are other users logged on to the computer. At line:1 char:1 + REstart-Computer...

Read More
Unable to Find a Default Server With Active Directory Web Services Running
Jan15

Unable to Find a Default Server With Active Directory Web Services Running

KB ID 0001275  Problem I was trying to get a list of all users on a client’s domain that had either a logon script, profile, or a mapped drive that was being set on their AD user object. But when I ran the command I got this error; Get-ADUser : Unable to find a default server with Active Directory Web Services running. Solution Active Directory Web services was introduced in Server 2008 R2, but I was running the command on a...

Read More
Move AD Group Members to an OU
Dec23

Move AD Group Members to an OU

KB ID 0001266 Problem I got asked to do this at work this week, PLEASE BE AWARE, moving users about within AD may drastically change the way your ‘User Group Policies’ are being applied. So do some Group Policy Modelling beforehand, to avoid any problems. Solution In the example above, I’ve got ten users in a security group called ‘Source-Group’. For simplicity, they are all in the same source OU as well,...

Read More
PowerShell – Updating Users Email Addresses In Active Directory
Jul05

PowerShell – Updating Users Email Addresses In Active Directory

KB ID 0001216  Problem Note: I’m referring to the Email address value that is listed on the user object in Active Directory, this will not effect any Exchange Settings! A colleague asked me today if I had any PowerShell to update ALL the users in a clients AD, to match their UPN to their Email addresses. A quick internet search turned up loads of handy scripts to update the UPN to mach the email address, but not the way round he...

Read More
PowerShell – List All Domain Users and Their Last Logon Time
Nov17

PowerShell – List All Domain Users and Their Last Logon Time

KB ID 0000752 Problem In the past I’ve looked at third party tools to do this but what if you wanted to use PowerShell? Solution   Heres’ a cool solution that might interest you also Updating Domain Computer Objects with User and Machine Information 1. On your server paste the following script into Notepad; $NumDays = 0 $LogDir = “.Users-Last-Logon.csv” $currentDate = [System.DateTime]::Now $currentDateUtc...

Read More
PowerShell Web Access
Nov17

PowerShell Web Access

KB ID 0001036 Problem One of my goals for this year is to become more proficient with PowerShell. During my studies I came across PowerShell Web access and thought it was so cool, I’d have a play with it. What is PowerShell Web Access? It’s a web service that runs on a Server 2012 IIS web server. It lets you remote connect to that host (via https) and then launch a PowerShell secure connection to any machine in your...

Read More
PowerShell – Update All Domain Users Email Address From UPN
Nov17

PowerShell – Update All Domain Users Email Address From UPN

KB ID 0001072  Problem Update: Here is an easier Solution Earlier in the year, I had a problem with Certificate Services, every time it tried to issue a ‘user’ certificate it gave me an error because the user did not have an email address specified on their user object in AD. At the time I thought “I wish I know enough PowerShell, to just put an email address in all the users e-mail attribute”. So while...

Read More