Showing posts with label powershell. Show all posts
Showing posts with label powershell. Show all posts

Monday, July 18, 2022

SolarWinds KB

 

I've been doing work on SolarWinds products for close to a decade now, including several years as a SolarWinds consultant. 

I'm kicking off a new blog dedicated exclusively to SolarWinds at https://solarwinds.gregkjono.com where I will be sharing various scripts, queries, tips and tricks that you can use to fix, enhance, automate and integrate your SolarWinds environment. There's an RSS feed available at http://solarwinds.gregkjono.com/feeds/posts/default which you can follow to get notified of new posts as well.

In relation, I am also starting to dump various scripts and queries to a GitHub repo. Feel free to follow me on GitHub if you'd like to keep an eye on it.

Wednesday, November 27, 2013

Quick JPEG Optimization to Speed Up Your Web Site

If you would like to quickly optimize the jpeg images for your web site, here's a quick method that works pretty good.

First, download jpegtran.exe, and save it to C:\

Download your image files to C:\Users\administrator\Desktop\files, or change the path in the code below to point to the root folder where you want to search for images to optimize. The script will crawl through subdirectories, so don't worry about the directory structure under the path that you specify.

Open a PowerShell prompt (you may need to "run as administrator" depending on your security settings). If your files are in a different path, or you placed jpegtran.exe edit the code below to reflect those difference. Run the code below.


$files = Get-ChildItem -Path C:\Users\administrator\Desktop\files -Recurse | where {$_.Extension -eq ".jpg"}
foreach($file in $files){
    [string]$image = $file.FullName
    [string]$cmd = "C:\jpegtran.exe -copy none -optimize $image $image"
    Invoke-Expression $cmd
}

The way the previous code is written, it will overwrite the existing file with the optimized one, so make a copy of them first if you want to keep the original as well.

I hope that helps. I optimized all of the JPEGs on one of my sites in a few minutes, and that includes writing the PowerShell code above.

Tuesday, March 19, 2013

Dynamics CRM: Authentication is Required - Timing Out and Prompting for Credentials

If you are running Dynamics CRM 4.0 and 2011 with claims based authentication, by default you get a prompt saying "Authentication is Required" after 20 minutes. If you want to extend this timeout, you need to make some changes to the relying party trust in Active Directory Federation Services (ADFS).

Wednesday, March 6, 2013

Fix Sharepoint/Powershell Error: The Farm is Unavailable

Below is an error that you can get in PowerShell or via STSADM for SharePoint

PS C:\> Get-SPServiceApplicationProxy
Get-SPServiceApplicationProxy : The farm is unavailable.
At line:1 char:30
+ Get-SPServiceApplicationProxy <<<<
    + CategoryInfo          : ResourceUnavailable: (Microsoft.Share...pplicationProxy:SPCmdletGetServiceApplicationProxy) [Get-SPServiceApplicationProxy], InvalidOperationException
    + FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletGetServiceApplicationProxy

Wednesday, January 30, 2013

Powershell Script to Delete Out Temporary Internet Files

If you have a lot of user profiles on a box, the user profiles can start to take up a lot of disk space. This is especially so on a Citrix or terminal services server, but can affect any system where more than a few people logon. I wrote a quick powershell script that can be scheduled to clean these out.


IIS Log Management Script in Powershell

IIS logs on a busy webserver can use up a lot of disk space. I wrote this little powershell script that I schedule to run on all of my web servers. It goes in and deletes out any IIS logs older than 1 year. Then it compresses any IIS logs that are left which are older than 1 day and are not already compressed. You can change the length of time for these to suit your needs by changeing the numbers in the "AddDays(-123)" parts of the script. Just make sure it's a negative number, or else you won't have any logs left.

Wednesday, January 2, 2013

Symantec Endpoint Protection 12.1 clients are holding onto multiple virus definitions, using a lot of disk space

There is a known issue with Symantec Endpoint Protection 12.1 clients where it does not delete the old virus definition files. These definition files build up and start consuming gigs and gigs of disk space.

They do have a fix for it now, which involves upgrading to Update Rollup 2 (UR2). Unfortunately,  you might not be able to upgrade right away. As a workaround, I wrote the powershell script below that will cleanup the old definition files. I schedule this to run daily.