On a domain? You can do something to all machines on a domain with this quick little script here. Your best bet is to open up an elevated (admin) Powershell Prompt on a domain controller and then run that here: Get-ADComputer –filter * | foreach { < do the thing > } Here are some examples that have really helped me in my administrative journeys: Force GPUpdate for all machines on the domain: Get-ADComputer –filter * | foreach { Invoke-GPUpdate –computer $_.name -force } Force … [Read more...] about The “do something to all machines” PowerShell Script
Microsoft Windows
Powershell script won’t run portion requiring Excel in Scheduled Task
Some of the scripting I've recently done requires Excel to be launched (non interactively) on a domain controller to gather usernames and whatnot. For some reason, the entire script would work perfectly besides the portion that requires Excel. I could run the script as an admin in ISE and it would work, but not via the Task Scheduler. Here's the fix: Create these two folders on your server: C:\Windows\System32\config\systemprofile\Desktop … [Read more...] about Powershell script won’t run portion requiring Excel in Scheduled Task
Exchange: Export a list of all public facing distribution groups
Public facing isn't the right term here. It simply means that the authentication requirement to send mail to the distro has been disabled to give anyone anywhere the ability to send an email to it. That makes it publicly accessible. If you want a list of all of the distribution groups that have the authentication requirement disabled you can use this little one-liner. Open Exchange Management Shell as an Administrator and type the following: Get-DistributionGroup | ? … [Read more...] about Exchange: Export a list of all public facing distribution groups
Migrating VEEAM Backup Data
If you want to move backups from one location to another, you're going to need to make sure you have some things configured properly. Here are a few things I learned while migrating to a larger storage area for my data. It's definitely easier, arguably faster, to migrate data using ROBOCOPY. Even though you'll have more thread available to migrate data using ROBOCOPY, you're only as fast as your storage and your processing power. A big copy and paste of your data using windows won't be much … [Read more...] about Migrating VEEAM Backup Data
Using ROBOCOPY switches for faster, more reliable data moves
For a lot of big data moves that don't require special software but need to be logged, you can us ROBOCOPY, a built in file moving command that will not only let you log the moves but also enabling a multi-threaded structure for faster moves. Use this command with the following switches for the fastest possible Robocopy without interruption: robocopy C:\Folder1 C:\Folder2 /TEE /LOG:"C:\Test\log.txt" /E /FP /R:5 /W:1 /MT:128 robocopy C:\Folder1 C:\Folder2 is the base of your script. This … [Read more...] about Using ROBOCOPY switches for faster, more reliable data moves
PowerShell script to remove all Active Directory computers in a list
Scenario You made an awesome list of old computers and now you want to delete these computers using PowerShell for the sake of cleaning up AD. The Script Here you go: Import-Module ActiveDirectory Get-Content C:\scripts\to-delete.txt | % { Get-ADComputer -Filter { Name -eq $_ } } | Remove-ADObject -Recursive -WhatIf Explanation Separate each action by the pipe, that's the little thing that looks like | Get-Content is where you'll grab the information in the text file. Mine was … [Read more...] about PowerShell script to remove all Active Directory computers in a list
Anti Spoofing for Domains in Exchange 2016
If your'e getting mail from outside sources pretending to be on your domain, you can create a Mail Flow Rule to manage messages that say they are from your domain but really aren't. Log into the ECP and go to Mail Flow > Rules and New (+) Click "more options..." You want to add two applications. Apply this rule if: The sender domain is 'yourdomain.com' The sender location is from outside of the company You can treat mail that triggers those two applications any way … [Read more...] about Anti Spoofing for Domains in Exchange 2016
Use PowerShell to list your folders on a server or share
Here's a quick script to list all of the folders on a share or on a server. This script will use PowerShell to export a list of folders to a CSV file. We'll be using the Get-ChildItem cmdlet to accomplish this. Get-ChildItem \\FS01\Shared -Recurse -Name -Directory | Out-File "C:\misc\Folders.csv" Let's break this down: Get-ChildItem is the cmdlet. It is just like "dir" or "ls" where it's main job is to tell you the contents of a folder. You can learn more about Get-ChildItem … [Read more...] about Use PowerShell to list your folders on a server or share
Log on as Batch Job Rights for Task Scheduler
Scenario: You just created a scheduled task that needs to be run even when nobody is logged on. You have a service account to mange the job and it will run with the highest privileges. Unfortunately, you run the task and nothing happens when the task is triggered. Solution: This could be the result of many things, but there's a good chance the service account you chose doesn't have "Log on as Batch Job" rights in the local security policy of the server. Here's how to enable that: Go to … [Read more...] about Log on as Batch Job Rights for Task Scheduler
Get-ADUser Extended and Default Properties
Here's a big list of all of the properties that you could apply to the Get-ADUser cmdlet in Powershell: Property Syntax R/RW lDAPDisplayName AccountExpirationDate DateTime RW accountExpires, converted to local time AccountLockoutTime DateTime RW lockoutTime, converted to local time AccountNotDelegated Boolean RW userAccountControl (bit mask 1048576) AllowReversiblePasswordEncryption Boolean RW userAccountControl (bit mask … [Read more...] about Get-ADUser Extended and Default Properties
Recent Activity