How to Append Data to a Text File Using PowerShell

You can use the PowerShell add-content cmdlet to append data to a text file. Here are an example and the command-line options that you can use. Powershell add-content example Step 1. Open PowerShell with elevated privileges Step 2. Execute the following command, (change the file path) Add-Content c:\scripts\test.txt "The End" By default, the data is appended after ... Read more

ERR2: 7621 Failed to move source object. Verify that the caller’s account is not marked sensitive and therefore cannot be delegated. hr=0x8009030e No credentials are available in the security package.

When you are migrating objects from child domain to parent domain using ADMT v 3.2, you may get the following error, ERR2: 7621 Failed to move source object. Verify that the caller’s account is not marked sensitive and therefore cannot be delegated. hr=0x8009030e No credentials are available in the security package. Solution Check if the ... Read more

How to Elevate Windows Batch Scripts to Run it with Admin Rights at Startup

1. Download the PowerToys and extract the contents of an EXE file in your desired folder. 2. Create a batch script with the following command, "C:\Program Files\Elevation\elevate.cmd" "C:\My batch files\<batch file name say batch.bat>" batch.bat contains all the commands you would like to run with administrative privileges. 3. Copy batch.bat to the following startup folder, ... Read more

Script to Reset Windows Network Adapters

If you want to reset network adapters on Windows Server, execute the following script on PowerShell (run PowerShell with admin privileges) You have to run the script locally on a server machine. while($(ping 8.8.8.8) -like "*Reply*"){ "Server replied" } "Server unreachable" Restart-NetAdapter Ethernet0 Send-MailMessage -From "[email protected]" -To "[email protected]" -Subject "server down" -SmtpServer "smtp.yourdomain.com" Reference https://4sysops.com/forums/topic/script-to-reset-network-adapters/