useful batch files for system administrators

Before making the following changes to the registry, you should back up any valued data on the computer. The following three command options can be useful to implement: Option. These features a lot of structure, organization, and emphasis on functions, or calling other scripts to do the rest. To disable a particular completion character in the registry, use the value for space (0x20) as it isn't a valid control character. If you have a list of programs you open each time you fire up your computer, you can use a batch file to automate the process. I still would love to see other people's batch files!! Now the settings are included in BlackViperScript. Define software packages using Boxstarter script and Chocolatey commands, or simply a comma-separated list of chocolatey packages. So long as the operating system recognizes the script's commands, the batch file will execute the commands from start to finish. I hope you find it useful. The forfiles command is most often used within a batch or script file. 11 Useful Windows Stuff to Know as System Administrator Invicti Web Application Security Scanner - the only solution that delivers automatic verification of vulnerabilities with Proof-Based Scanning. To change this control character, run regedit.exe and navigate to either of the following registry keys and entries, depending on whether you wish to change the value for the current user only, or for all users of the computer. By the way you can also unlock ad accounts and investigate the cause of a lockout with Netwrix Account Lockout Examiner free tool! To list all the tasks running with their PID and Memory usage, you can use tasklist command. NET SEND is obsolete. All contributions are welcome. Following the xcopy command is a string of parameters that include extra tasks: Now, if you want to add more backup locations to the batch file, use the following command: The batch file includes several folders to copy. For this example, I will be using the Desktop on my PC. In all three cases, the -Filter parameter can help you find what you need that much faster. Once an exploit is in place, they can change group membership to the administrator group. By the way you can also unlock ad accounts and investigate the cause of a lockout with Netwrix Account Lockout Examiner Opens a new window free tool! To do this, right-click the file and select Rename, then change the file extension as above. The parameters below and in the worksheet are for the database configuration. sysadmin-scripts You missed my talk at SpiceWorld this year. After saving, you can change the file extension from .txt to .bat, which changes the file type. (note: you need an administrator account to be able to use this). If your Windows server is rebooted unexpectedly and needs to find out when exactly it happened then this would be very handy. - Gary Kildall. or be specified relative to the program startup location. It's a powerful pipeline that gives you direct control over your computers and servers. Reddit and its partners use cookies and similar technologies to provide you with a better experience. You may also use wmic cpu command to get this information. If you are into the Production Support/Middleware Administrator then most probably you will have to work on Linux and Windows OS. CSO has identified ten of those scripts that should be part of your security teams toolbox. As featured on Windows Central, you can run the powercfg/batteryreport command to generate a report on your battery status. You may either kill the process with taskkill command or Task Manager. "It's much, much easier to use this cmdlet once you learn that.". The echo statements above help to understand the environment. You can set an environment variable, delete the argument with shift, and then repeat the process until all options have been removed. Share Improve this answer Follow ipconfig is a handy command to find out the IP address of the Windows server. In other words, this is a built-in PowerShell tool that helps you find what you're looking for. These 10 PowerShell scripts should not be considered standalone, but as a much larger collection of tools needed to manage workstations and servers. PowerShell can be used to set local security policies with the PowerShell script SecurityPolicyDsc. The first and most basic cmdlet every system administrator should know is Get-Help.According to PowerShell expert Thomas Lee, who's known in the Spiceworks Community as tfl, Get-Help is one of the most useful tools in PowerShell for IT pros of any skill level."Being able to use discovery built into PowerShell such as Get-Help to learn more . To associate your repository with the Taking screenshots is one of the most common tasks, whether on a PC or phone. User-specified settings take precedence over computer settings, and command-line options take precedence over registry settings. This is usefull for when you have duplicates of a file throughout your hard drive. Share Improve this answer Follow edited Nov 16, 2016 at 0:00 Peter Mortensen When you want to switch back to a dynamic IP address, you can use this batch file. According toTechNet, "Computers running Windows 7 and later include WinRM 2.0 or later. These ten scripts or topics just scratch the surface of what can be done with PowerShell. Download the text file, then switch the file extension from .txt to .bat, and you're good to go. Youre not alone if youve encountered d3dx9_43.dll not found or d3dx9_43.dll missing on your Windows PC. Sure, you could change between a dynamic and static IP address manually. I will most definitely put these tools to use. Batch Functions, Templates, Tools, and Scripts. Cookie Notice Use functions-template.bat to get started quickly! One key way to reduce lateral attacks in a network is to remove common local administrator passwords. A reddit dedicated to the profession of Computer System Administration. Create and save a text file in any location you If only someone would make it RFC2324 compliant Set-AdServerSettings -ViewEntireForest $True, Useful if you have parent/child domains like we have. CSO |. The command Set-RemoteDomain [remote domain name] -AutoForwardEnabled $false ensures that attackers can send emails from your network without you knowing about it. This technique is called network discovery. Use it to automate actions. Windows will resume updates when you tell it to restart/shutdown. To allow running the batch file from any folder, Doing so in Native PowerShell is only a bit easier than in VBS [VBScript?] This script allows for a much easier management of permissions on files and folders . ; and OS customizations that cannot be performed by Boxstarter, such as customizing the Taskbar, Start Menu, Desktop, etc. You can then follow the guidance located at the Center for Internet Security or provided by NIST.gov to set a hardened operating system. To create your own, make a copy of BoxstarterInstall-template.bat and rename it to fit your project. You signed in with another tab or window. DOS Command Extensions - available on Windows 2000 and up - add a lot of automatic parsing and expansion that really simplifies reading filenames passed in as parameters. It can be helpful to set the title of a command prompt window, Maybe the -filter parameter would work here. Like the -filter. Most Useful Powershell Commands to Manage Processes Another set of most useful PowerShell commands for Windows administrators are Cmdlets to manage Windows processes. In the example, the drive is set to "X." Knew about stop-computer and many others. This is useful for running multiple commands in sequence in one operation, giving you the option to utilize Schedule Task to execute at a later time. Remove consumer features from consumer SKUs, Sysadmin Sidekick Toolkit - Syadmin best friend to battle evil of day-to-day work. All code or functions gained from other sources are referenced in place where used with links. Try typingGet-ChildItem -Path "C:\Windows\System32\" -filter *.dll.). But for now, you can stick with Notepad, as each example batch file below has been tested using that program. I have been using a much longer command to filter stuff out. Even attackers acknowledge that PowerShell is key to controlling workstations making PowerShell a key way that attackers pivot and do lateral movement on a network once they gain access. To compare two ASCII files, use a command like . This The tool can check if the device can run Device Guard or Credential Guard, check for compatibility with the Hardware Lab Kit tests that are run by partners, enable and disable Device Guard or Credential Guard. Quickly assemble new batch script (*.bat) automations: Get started with some unique and useful tools: BoxstarterInstall-NetworkingUtilities.bat, Migrate TimeFunc PowerShell module to separate repo, Migrate Documentation automation scripts to separate repo, Migrate Chocolatey and Boxstarter automatic software install helpers, Migrate Task Tracker PowerShell module to merge with StackWorkflow module, Migrate PowerShell demo / practice / hello world module/scripts to separate repo, SS64 Run with elevated permissions script (ElevateMe.vbs). If you have a number of repetitive tasks, you can write a batch file to automate the process. In fact, it's the absolute opposite. Once the operating system has been identified, Administrators can have an understanding of expected, common services and processes. If you're susceptible to Pokmon-related gaming addictions, you should give this one a miss because it's essentially Pokmon Red in text form. In August of 2016, it was made open-source and cross-platform with the introduction of PowerShell Core. All 4 of these scripts are Boxstarter helper scripts; they are practically identical. Supports drag-and-drop of files one-at-a-time. This fork of the PSHTML-AD-Report project adds functionality to the existing report tool so that metrics can be collected from VMWare infrastructures. Collection of automation scripts. Parse: Parsers for Nmap, DNSRecon and other types of output files from security tools. Then you can use the LAPS Reporting PowerShell script to audit the use of the LAPS toolkit or use a LAPSpass to retrieve a password for a single user. As noted in the blog, a sample event that can be tracked using the ProcessAccess filter for Local Security Authority Subsystem Service (LSASS) to detect if a malicious process is trying to extract credentials from memory. By default, if you name your your new project script, gswin64c.exe (Ghostscript) "%_GSWIN64C_INSTALLED%", Phase 4: Test Banner.cmd (external function), Phase 7: Test :GetDate, :ConvertTimeToSeconds, and :ConvertSecondsToTime, Phase 8: Test :InitLog and :InitLogOriginal, Phase 9: Test :CreateShortcut, :CreateSymbolicLink, and :CreateSymbolicDirLink, functions > RunAsAdministrator > BatchGotAdmin International-Fix Code.bat, functions > RunAsAdministrator > SS64 Run with elevated permissions (ElevateMe.vbs).bat, System Clean-up folder (virus removal & system tune-up utilities), Find-and-Replace function for all files within a folder and subdirectories. Drag-and-drop the second file onto the cmd window that just appeared. One script that can monitor this change is MonitorADGroupMembership. Related: How to Batch Rename & Mass Delete Files in Windows. Used to troubleshoot batch files that close immediately on error, by keeping last errors open in command prompt for review. I have also used it to kill off a virus that copied itself to various folders on my hard drive. There are dozens of recovery tools on the market, but not all of them work as you expect. The part you want to run in normal cmd paste it in regular folder, & from here call the second batch file which is there is system32. Before Windows became our favorite GUI, everything was done using commands. However, configuring each system independently can be a hassle. A system administrator's job description might include: Managing Windows, Linux, or Mac systems. The additional batch file commands used here are: When you run the batch file, it will take a backup of the defined files and folders and then shut down your computer. I would love to see some of the batch files that other people use. PowerShell is a powerful tool that can be used in multiple ways. WireShark. Here's an explanation as to what the commands in this batch file mean and the bits you can customize. Invicti uses the Proof-Based Scanning to automatically verify the identified vulnerabilities and generate actionable results within just hours. environment variables, which will impact the behavior of the called Cygwin program. Persistent through reboots. The forfiles command selects one or more files to execute a specified command on. To backup the installed software on your PC, all that's needed is a copy of your Boxstarter script on the backup drive. This program facilitates resources for games like League of Legends, GTA, Guild Wars, Noire, etc. For the AuchType, you'll enter either Negotiate (0) or Basic (1), which specifies what authentication method you'll use. To stop the countdown, press Windows Key + R. (Of course, don't tell the kids this!). I didn't realize it was taken off for vista and 7 :/ is there another similar service used on vista and 7? Communication with the node agent is enabled by one or more load balancers, the number of which depends on the number of nodes in a pool. "Reset is nice because the cmdlet will just prompt you for the new password instead of you having to jump through hoops and give it a password in a secure string," Martin says. The batch file uses the MS-DOS character set, has an extension of .bat . Thanks for the write-up. Therefore, it is a good idea to search about these tools and learn about their features, pros, and cons before you buy them. You can add as many applications and files as you want to the batch file. For example: It may be difficult to implement required functionality in a Windows batch file. Troubleshooting and providing technical support to employees. Be Careful! google_ad_type="text_image"; You can use PowerShell to determine if machines are able to support these enhanced technologies as well as deploy settings using ConfigMgr. New comments cannot be posted and votes cannot be cast. Disable Forced Reboot after Update -- Blocks Windows from enforcing a reboot after updates that require one. move-item -path . Boxstarter is the perfect tool to set up a fresh-out-of-the-box computer with software and OS tweaks, customized to your exact needs. But let's say you're logged into an account that doesn't have the rights to remotely shut down a computer. With AutoHotKey installed (a language that allows you to automate sending keystrokes and mouse clicks), this script allows you to paste text into locked fields that otherwise block clipboard pasting. CompareTo-Parent.bat (located in the Tools folder) is a great for merging text documents utilizing KDiff3.