Using Different Authentication for File Monitor

Topics: PolyMon 2.x, User Forum
May 19, 2015 at 5:43 PM
Hi, I love this simple, basic tool for monitoring some of my critical resources. It's been very stable for me, with only 5 monitors, running for about three months with no app restarts. I use this as a backup to the our 'enterprise monitoring'. This is something that I run on a test desktop under my desk, knowing that it's informational only in that scenario, and the enterprise solution is the primary.

Anyway, I would like to make sure that a UNC path always has fresh log files (newer than 120 mins). This folder is at a SAS / App host, and is accessible from our network, but I have to authenticate with their domain using a specific set of credentials to access the folder. We can't create domain trust relationships (or similar).

Any ideas?
May 19, 2015 at 6:10 PM
You can setup a Powershell script that sends credentials along with what work you want it to do, like list files, etc.. Here are some basic PowerShell commands that will guide you with this task. Remember that in your PowerShell script you must output/set the StatusCode and StatusMessage properties.

StatusCode; 1=OK , 2=Warn , 3=Fail (basically any number outside of the 1,2 range is a failure)

Here are the PowerShell nuggets..
-creates secure password
$plainText = "MyPassword"
$secureString = ConvertTo-SecureString $plainText -AsPlainText -Force

-creates a credentials object using your info as specified above (fill in your domain and username obviously)
$MyCred = New-Object System.Management.Automation.PSCredential("domain\username",$secureString)

-map a drive to the remote location
New-PSDrive -Name X -PSProvider FileSystem -Root \fileserver1\downloads -persist -Credential $MyCred

-call a quick command to do something (this gets the items in the drive you just mapped)
get-childitem x:\

The above command(s) you would run your powershell stuff to find dates, file sizes, qty, etc. Then set your StatusCode and StatusMessage (if necessary) and you are done. Enjoy..
  • Jon Ebersole