I had a request recently to provide an inactive user report for the past 60 days. Basically, find out which accounts have not logged in for the past 60 days so action can be taken against them. The request was for a multi domain forest which queries every domain controller and gets the latest lastlogon…
Tag: file
Get .Net Framework Version for the .DLL & .EXE files
Working with many app/dev teams it is hard to find which version of Dot Net an application was designed or made in. Now if your application server has multiple drives and depending on which drive the application resides it may be hard to find this information. Let’s assume there are two drives C: and D:….
Guide to migrate FRS to DFSR
For most users this article only applies if you have Window 2003/ 2003 R2 Domain Controller in your enviornment that you are planning to get rid off. Pretty soon I hope! 😉 SYSVOL is a folder shared by domain controller to hold its logon scripts, group policies and other items related to AD. All the…
How to restart management agents on ESX or ESXi host
If you are not unable to connect ESXi server to vCenter, or when you cannot connect to ESXi server from VI client it may be necessary to restart the management agents on ESX or ESXi host. To restart the management agents on ESXi 6.x This applies to ESX4/5.x/6.x For the restart of the management agents (mgmt-vmware…
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…
Delete Files and Folders Older Than X Days
Often times admin have to creates tasks like removing log files or some other files on a regular schedule. Here is an automated way of removing files / folders older than X days. Create a Batch file or Powershell script and add it to scheduled task. Batch File:
1 2 3 4 5 6 7 8 9 10 11 12 |
@echo off :: set folder path set dump_path=c:\shares\dump :: set min age of files and folders to delete set max_days=7 :: remove files from %dump_path% forfiles -p %dump_path% -m *.* -d -%max_days% -c "cmd /c del /q @path" :: remove sub directories from %dump_path% forfiles -p %dump_path% -d -%max_days% -c "cmd /c IF @isdir == TRUE rd /S /Q @path" |
Powershell:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
# set folder path $dump_path = "C:\shares\dump" # set min age of files $max_days = "-7" # get the current date $curr_date = Get-Date # determine how far back we go based on current date $del_date = $curr_date.AddDays($max_days) # delete the files Get-ChildItem $dump_path -Recurse | Where-Object { $_.LastWriteTime -lt $del_date } | Remove-Item |
Active Directory: Changing passwords for users in bulk using a .csv file
Many accounts in your AD might need a password change. What if you want to do this in bulk ? First, we need to the userlist. Depending on your requirements we need to get a list of users (specifically samaccountname). For random password generation I recommend using http://manytools.org/network/password-generator/ as it can generate up 1000 for…
Maintain Your Mac – Check the File System for Errors
Use File System Check Your Mac seems stable and healthy, and you figure you’ve got it made. Because of this, you’re probably thinking you don’t need to check the file system for errors. Don’t do that though, because there may be problems lurking in the background that you can’t see. Just as it’s a good…