PowerShell MIM 2016 Run Profile

This is a quick PowerShell script to run a specific profile on a MIM 2016 agent.  To note this assumes you have MIM 2016 Sync Services installed, and you are running this from that server.  This will ideally help you setup a scheduled task for running profiles. ##Get the Agents currently setup on the local […]

Perl Time Stamp Compare

Work in Progress… The script below is a work in progress for another project.  I figured I would go ahead and post it in the event that some part of it is helpful to someone.  The perl script below takes a custom date/time and converts it to epoch, and then it is subtracted from the […]

Get file/registry version number as a version object

Sometimes, version numbers of applications can’t be compared directly because they are interpreted as strings (where 10 comes after 1 but before 2). A really simple way to work around this is to typecast the version number with [version]. $installVersion = [version]”58.0.3029.81″; $fileVersion = [version](Get-Item -Path $chromeExe).VersionInfo.ProductVersion; if ($fileVersion -lt $installVersion) { #Upgrade } $registryVersion […]

PowerShell HTTP Server Service Monitor

Below is a PowerShell script to setup an HTTP server, and display the current status of a service.  If the service changes to stopped or running, the hosted webpage will update the status.  Make sure to set your IP address in the $prefixAddr value, your service name in the $serviceName value, and set $timer to […]

PowerShell Get IP Address on Mac

PowerShell on a Mac!  Below is a quick throw together on how to use PowerShell on a Mac to pull the local IPv4 IP address.  Enjoy. $interfaces = [System.Net.NetworkInformation.NetworkInterface]::GetAllNetworkInterfaces(); foreach ($interface in $interfaces) { $ip = $interface.Addresses.IPAddressToString; $intStatus = $interface.OperationalStatus; $intType = $interface.NetworkInterfaceType; if ($intStatus -eq “up” -and $intType -eq “Ethernet”) { write-output $ip[1]; } }

PowerShell Speech Recognition

So I got bored this weekend and started looking into “System.Speech”.  First it started with making my computer talk and then I realized I could talk to my computer by utilizing “System.Speech.Recognition.SpeechRecognitionEngine”.  Below are the results of my boredom, and with this script you can give your computer verbal commands.  Enjoy. [void][System.Reflection.Assembly]::LoadWithPartialName(“System.Speech”); ##Setup the speaker, […]

PowerShell eDirectory Group Membership Query

I found my self needing to query eDirectory for all the group objects and their members.  Below is the PowerShell script to accomplish this.  At its core, it is an LDAP query. $ldapAssembly = [System.Reflection.Assembly]::LoadWithPartialName(“System.DirectoryServices.Protocols”); function ldapQuery() { param($hostName,$authUser,$basedn,$filter); $eDirConnect = New-Object System.DirectoryServices.Protocols.LDAPConnection “$hostName”; $eDirConnect.AuthType = [System.DirectoryServices.Protocols.AuthType]::Basic; $password = Read-Host -Prompt “Password” -AsSecureString; $queryCreds = […]