If you have a list of hostnames/servers that you need IP addresses for its cumbersome to ping each server and get the ip address. PowerShell to the rescue! To do this we need a file called Server.txt with each server’s hostname on each line. I am storing the file in D:\Data\Servers.txt. Once we run the…
Tag: powershell
Connecting to a remote domain controller using PowerShell
Covering one of the basic day to day task if you are a Windows Administrator; connecting to the domain controller. Â I try to minimize logging onto servers as much as possible. Â Your thought should be around connecting to the server remotely and doing the work as needed instead of natively logging on to it. I…
No remote Desktop License Server available on RD Session Host server 2012 R2
A fully functional and activated 2012 R2 Remote Desktop Session Host server displayed the following message: This was a simple setup on one server with the: connection broker, Session Host and Licensing server with 2012 R2 CAL’s installed. Even though the licensing seems to be configured correctly, in server manager: and PowerShell: Licensing diagnostics: everywhere…
Office365: List Your Business Can’t Live Without
When you have a lot of conference rooms, equipment or special rooms mailboxes it is hard to list or find available free rooms during a particular time slot. Luckily, Office365 and Outlook 2013/2016 have a special feature called ‘Room Lists’, which enable you to find and schedule a room quickly based on availability and offer…
How To Get Rid Of Dell KACE Agent?
What is Dell KACE Agent? Unifies and automates non-computer and computer asset management processes from deployment to retirement, to facilitate such tasks as software and regulatory compliance. Uninstalling KACE can be a pain. Luckily there is a way thanks to wmic. This works for 32 & 64 bit machines From Command Prompt/ Powershell in Admin…
Cleaning up Office365 Groups Mess
Office 365 Groups are a shared workspace for email, conversations, files, and events where group members can collectively get stuff done. It compliments the introduction of Microsoft Teams. The main thing to keep in mind is that this feature is still evolving. Why is it important to control Office 365 Group creation? This feature is…
Creating Security Groups for File Shares in Bulk using PowerShell
Security Groups are great for managing large groups for permissions. Â A client requested that they needed to have Read-Only, Read-Write, and Ready-Modify (allow for deleting) for all their file shares for better management. Getting the Share Names In order for me to create the groups I needed the share names. PowerShell to the rescue! Type…
Remove duplicates, blank lines, spaces, to get unique values and sort data in one operation
From time to time I come across this need; where I need to scrub a file where there are duplicates, there are blank lines, the sort order is all wack, and it just needs to be formatted to where it can be more readable and/or usable. This method just doesn’t apply to text, but also…
Set password never to expire for users in a particular domain (Bulk mode)
Let me start by saying that I don’t recommend doing this at all. Password Never Expires is bad security practice, but there are situations that might require it. I had a similar request on how this could be done. Setting it for multiple users:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
#Connect of Office365 Import-Module MSOnline $O365Cred = Get-Credential $O365Session = New-PSSession –ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell -Credential $O365Cred -Authentication Basic -AllowRedirection Import-PSSession $O365Session Connect-MsolService –Credential $O365Cred #Get a List of user that belong to the second domain $SDusers = Get-MsolUser -All -DomainName "yourseconddomain.com" #Setting the password never to expire ForEach($SDuser in $SDusers) { Set-MsolUser -UserPrincipalName $SDuser -PasswordNeverExpires $true } |
Setting it for a single user:
1 |
Get-MSOLUser -UserPrincipalName user@domain.com | Select PasswordNeverExpires |
Get PasswordAge for users in a particular domain
In Office365 if you have more than one domain in a subscription, there are times where you may want to get the password age for users of that domain. In my case to check which users are covered and meeting policy and get the users addressed.
1 |
Get-MsolUser -All -DomainName "yourdomainname.com" | select DisplayName, LastPasswordChangeTimeStamp,@{Name=â€PasswordAgeâ€;Expression={(Get-Date)-$_.LastPasswordChangeTimeStamp}} |
The output will be similar to: