Posts

How to loop "ipconfig /renew" until it gets IP address on remote PC to test DHCP using PowerShell

The script below will loop until it received IP address from DHCP server.  If id does not receive IP it will loop indefinitely or until you stop manually or reboot PC.  I used this script on remote PC, while it had and IP address but I needed to test if DHCP server is working or could reach client via site-to-site VPN.  If PC did not come up I knew I had to fix VPN or server, etc.  1. Open command prompt by right-clicking on the "command prompt" or PowerShell icon and select "Run as administrator" 2. If you open command prompt, type PowerShell to start power shell    Microsoft Windows [Version 10.0.18362.535]   (c) 2019 Microsoft Corporation. All rights reserved.   C:\WINDOWS\system32> powershell   Windows PowerShell   Copyright (C) Microsoft Corporation. All rights reserved. 3. Run these two command and save the computer name and domain name for later, we might need it.     PS C:\WINDOWS\system32> $env:computername     MYPC-TEST

PowerShell Script to close all open tickets using PRTG API URL

# How to get rid of all PRTG tickets if you don't use them # # 1. Setup retention for closed tickers to one day # Setup > System Administration > Core & Probes > Historic Data Purging > Closed Tickets # # 2. Save this PowerShell script to a file and schedule it to run daily # # # PowerShell Script to close all open tickets using PRTG API URL # R7G5 / 2019-11-14 # Ensuring TLS/SSL connection to our host add-type @ " using System.Net; using System.Security.Cryptography.X509Certificates; public class TrustAllCertsPolicy : ICertificatePolicy { public bool CheckValidationResult( ServicePoint srvPoint, X509Certificate certificate, WebRequest request, int certificateProblem) { return true ; } } " @ [ System.Net.ServicePointManager ]::CertificatePolicy = New-Object TrustAllCertsPolicy # return codes $http_code = @{ 200 = "OK"; 302 = "Found"; 400 = "Bad R

PowerShell Script to Sort Your Photos into "YYYY-MM-DD" folders by the date they were created

This 3-liner will read the folder where you have many pictures. Then it will read the date pictures/files were created and create a new folder (Ex: 2016-12-31). Then it will move corresponding pictures into this folder. So you will have all the pictures sorted out into the folders with corresponding date. $DestRootDir="C:\Users\MyUsername\Pictures\" $fotos = Get-ChildItem $DestRootDir |  ? {!$_.PSIsContainer} | Group-object -Property @{Expression={$_.CreationTime.ToString("yyyy-MM-dd")}} -AsHashTable -AsString $fotos.GetEnumerator() | % {New-Item -Path $($DestRootDir+$_.Key) -ItemType Directory; $dest=$DestRootDir + $_.Key ; $_.Value | % {Move-Item $($DestRootDir+$_.Name) -Destination $dest} } BEFORE:     C:\Pictures             File1.jpg (created Nov 24 2015)             File2.jpg (created Nov 24 2015)             File3.jpg (created Dec 31 2015)             ...             File100.jgp (created Jan 1 2016) AFTER:    C:\Pictures              20

Windows Batch script to remove Windows Update Backup files

Create a file called "cleanup.cmd" Paste text below there: for /f %x in ('dir %SYSTEMROOT%\$*$ /s /b') do (rmdir /s /q %x) for /f %x in ('dir %SYSTEMROOT%\ie7updates\KB* /s /b') do (rmdir /s /q %x)

How to enable "Send As" permissions for BESAdmin account for multiple users

In Active Directory 1. Right click on Domain lever or container 2. Select Properties 3. Go to Security Tab 4. Click Add and add BESAdmin account and click OK 5. Make sure "BESAdmin" account is selected and click "Advanced" 6. Select "BESAdmin" again in the list of "Permission entries" 7. Click "Edit" 8. Select "User objects" in "Apply onto:" field 9. Enable "Allow" checkbox for "Send Ad" permissions 10. Click all Apply and OK buttons to close all windows * Alwasy make sure that required user objects have "Allow inheritable pesmissions ..." option checked, otherwise "Send As" permission wont propagate from the parent level.

When users is trying to open PDF file from the internet using browser he gets following error message - Problem (1:1)

Image
SYMPTOMS When users is trying to open PDF file from the internet using browser he gets following error message: Title: Adobe PDF Document Error:       There is a problem with Adobe Acrobat/Reader.       If it is running, please exit and try again. (1:1)        Simple way to test is to point browser to any online PDF link.  RESOLUTION The required registry key is missing or does not have correct permissions set. 1. Login to a server or user's PC that has this problem 2. Open registy editor: Click  Start \ Run Type  regedit  and click ok 3. Browse to HKEY_CLASSES_ROOT\Software  4. Verify if  Adobe\Acrobat\Exe  key exists. 5. If it exists skip to step 6 otherwise follow inscructions below to create one 5.1 Right click on Software, New, Key 5.2 Type  Adobe  and hit enter 5.3 Right click on Adobe, New, Key 5.4 Type  Acrobat  and hit enter 5.5 Right click on Acrobat, New, Key 5.6 Type  Exe  and hit enter 5.7 Click on Exe and double click on (Default)

Script to List, Query and Assign Load Evaluator on Citrix Metaframe Server

Create a file call is LE.vbs and copy script below to that file. Then go to command prompt switch directory to the one you saved script to and run the script: If you only use server name as a prarameted you will get a list of all available load evaluators. Also the on that is currently assigned to a server will be marked by "*" sign Command:      LE.vbs MYCTXSRV01 Output:     List of available Load Evaluators:     * - current LE assigned to a server      LMSDefaultLE      MFDefaultLE    * VM Servers      Offline If you use this with the Load evaluator name script will assign it to the server and then print the list of load evaluators again If Load evaluator has space in the name use quotations. Command:     LE.vbs MYCTXSRV01 "VM Servers" '--/ BEGIN SCRIPT /--' If (WScript.Arguments.Count <> 2) Then   Dim mfFarm   Dim mfLE   WScript.Echo "Attaches a load evaluator to a C