• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer

danblee.com

Tutorials & Knowledge Base Articles for System Administrators who wear many, many hats.

  • Home
  • About
  • Ask Me
  • DBLHost.com
You are here: Home / Archives for Scripting

Scripting

The “do something to all machines” PowerShell Script

January 6, 2021 by Dan B. Lee Leave a Comment

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

Filed Under: Active Directory, Group Policy, PowerShell Tagged With: Active Directory, Domains, PowerShell, Scripting

Powershell script won’t run portion requiring Excel in Scheduled Task

September 26, 2019 by Dan B. Lee Leave a Comment

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

Filed Under: Microsoft Excel, Microsoft Office, PowerShell Tagged With: Excel, PowerShell, Scripting, Task Scheduler

Exchange: Export a list of all public facing distribution groups

February 6, 2019 by Dan B. Lee Leave a Comment

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

Filed Under: Exchange 2003, Exchange 2010, Exchange 2013, Microsoft Windows, PowerShell Tagged With: Exchange, Exports, Microsoft Exchange Server, PowerShell, Scripting, scripts

Use PowerShell to list your folders on a server or share

May 3, 2017 by Dan B. Lee Leave a Comment

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

Filed Under: Microsoft Windows, PowerShell Tagged With: CMD, PowerShell, Scripting, scripts

Log on as Batch Job Rights for Task Scheduler

April 11, 2017 by Dan B. Lee 4 Comments

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

Filed Under: PowerShell, Windows Server 2008 R2, Windows Server 2012 Tagged With: Batch Jobs, PowerShell, Scripting, Task Scheduler

PowerShell – Export Enabled Users and other Data from Active Directory

March 7, 2017 by Dan B. Lee 1 Comment

I made a script that does a few things: Gets all users that are enabled Creates a table, listing all the the users with a few account details I want Export the table to a .csv file with a unique name, appending the date the export happens Here's the whole thing. I'll explain what it does at the bottom: Import-Module ActiveDirectory # All of the properties you'd like to pull from Get-ADUser $properties=@( 'displayname', 'lastlogondate', 'passwordneverexpires', … [Read more...] about PowerShell – Export Enabled Users and other Data from Active Directory

Filed Under: Microsoft Excel, Microsoft Windows, PowerShell, Uncategorized Tagged With: Active Directory, CMDlet, Get-User, Last Logon, Password Set To Expire, PowerShell, Scripting

Primary Sidebar

Categories

  • Active Directory
    • Group Policy
  • Adobe Photoshop
  • Browsers
    • Chrome
  • Cloud Based Technology
    • Citrix XenApp
  • ConnectWise
    • LabTech
  • Dell
  • Internet Service Providers (ISPs)
  • iPhone
  • Linux
    • CentOS
    • OpenVPN
    • SaltStack
    • Ubuntu
  • Microsoft Office
    • Lync
    • Microsoft Excel
    • Microsoft Outlook
    • Microsoft Word
  • Microsoft Windows
    • Active Directory
    • PowerShell
    • Windows 7
    • Windows 8 Preview & Release
  • Networks
  • News
  • Off Topic
  • Office 365
  • Peripherals
    • Monitors
  • Printers
    • Local Printers
    • Network Printers
  • Programming
    • Python
  • Riverbed
  • Security
  • Sharepoint
  • Social Media
  • Splunk
  • Storage
  • Switching & Routing
    • Cisco
    • Fortinet
  • Technology Culture
    • Opinion
  • Uncategorized
  • Virtualization
    • VEEAM
    • VMware
  • WAMP
  • Web Hosting
    • WHMCS
  • Website Design
  • Windows Server
    • Exchange 2003
    • Exchange 2010
    • Exchange 2013
    • Microsoft SQL
    • Windows Server 2003
    • Windows Server 2008 R2
    • Windows Server 2012
  • WordPress

Footer

Recent Activity

  • pings on Xerox Phaser 3635MFP Default Admin Username and Password
  • Xerox Phaser 3635MFP Default Admin Username and Password — danblee.com on About Dan B. Lee
  • Estudio Login | LOGINEGG on Toshiba E-Studio Default Administrator Username and Password
  • Estudio Login | LOGINSPENT on Toshiba E-Studio Default Administrator Username and Password
  • Estudio Login | CHARTLOGIN on Toshiba E-Studio Default Administrator Username and Password

Dan Lee

Dan B. Lee works at SyApps, LLC., a Managed Hosting Solutions Firm, as a Senior Network Engineer. Dan has a decade of IT experience and specializes in a number of different disciplines including Virtualization, Web Site Hosting and Design, Network Security, Data Center Architecture, Local and Remote Server Hosting, and Backup & DRS Solutions. Read More…

Links

  • Home
  • About Dan B. Lee
  • Ask Me
  • Privacy Policy

Copyright © 2021 · Genesis Child Theme on Genesis Framework · WordPress · Log in