Author Archives: Kelvin Tegelaar

About Kelvin Tegelaar

I am a Microsoft Certified System Engineer working as the CTO of the Managed Services Provider Lime Networks B.V. in the Netherlands. I mostly enjoy automating business processes by deploying PowerShell solutions, but just have a large passion for Microsoft Technology in general. If you want to contact me directly you can find me on twitter here, or via email: Kelvin {at} limenetworks.nl

Automatically mapping SharePoint sites in the OneDrive for Business client

Microsoft recently announced that the OneDrive for business client will support automatically mapping SharePoint sites – Which is something I’ve been working on to script for some time now. Automapping sites will be a great benefit for migrations where users are saying goodbye to the good old file system, and hello to SharePoint online. Combined with Files on Demands most users won’t even know the difference.

The only sad part about it is that my pretty cool logon script will become useless fairly soon, anyway I’m sharing this to everyone. Its still in a pretty unfinished state, but it might help you if you are currently struggling with this:

<#
.SYNOPSIS
Automaps the Onedrive client to sync with a sharepoint library
.DESCRIPTION
Run the script with all mandatory parameters
In order to use the parameters you need to fetch them from the applicable site.
Every _api link should have tenantname.sharepoint.com/ in front of it if it's the default site, or tenantname.sharepoint.com/sites/SITENAME for any other site.
If the _api data is hard to read, use a tool like https://codebeautify.org/xmlviewer
.PARAMETER siteid
_api/web
Search for "D:Id", here you will find the SiteID Guid
.PARAMETER webid
.PARAMETER listid
_api/web/Lists/getbytitle('NAMEOFTHELIBRARY')
Search for "D:Id", here you will find the ListID Guid
.PARAMETER URL
_api/web
Search for "D:web", here you will find the SiteID Guid
.PARAMETER webtitle
Set this to the name of the organisation
.PARAMETER listtitle
Set this to the name of the library
.EXAMPLE
.\SharePoint_Automapping.ps1 -siteid GUID -webid = "GUID" -listid = "GUID" -URL https://company.sharepoint.com/ -webtitle Company -listtitle Documents
which will create the following link for the OneDrive app:
start "odopen://sync/?siteId=GUID&webId=GUID&listId=GUID&userEmail=$upn&webUrl=https://company.sharepoint.com/&webtitle=Company&listtitle=Documents" 
.NOTES
In order to retrieve the _api info you need to log in to the tenant, no admin rights are necessary.
#>
param(
[string]$siteid,
[string]$webid,
[string]$listid,
[string]$URL,
[string]$webtitle,
[string]$listtitle
)
$rand = Get-Random -Maximum 10
sleep $rand
#Sleep is required, if the same script runs at the same time it'll mess up the configuration.
$Version = Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion' -Name ReleaseID | Select-Object ReleaseID
if($version.releaseID -lt 1709) { break }
$strFilter = “(&(objectCategory=User)(SAMAccountName=$Env:USERNAME))”
$objDomain = New-Object System.DirectoryServices.DirectoryEntry
$objSearcher = New-Object System.DirectoryServices.DirectorySearcher
$objSearcher.SearchRoot = $objDomain
$objSearcher.PageSize = 1
$objSearcher.Filter = $strFilter
$objSearcher.SearchScope = “Subtree”
$objSearcher.PropertiesToLoad.Add(“userprincipalname”) | Out-Null
$colResults = $objSearcher.FindAll()
$UPN = $colResults[0].Properties.userprincipalname
$path = "C:\Users\$($env:username)\Lime Networks BV\Lime Networks - $($listtitle)"
if(Test-Path $path){
#DoNothing
} else {
start "odopen://sync/?siteId=$siteid&webId=$webid&listId=$listid&userEmail=$upn&webUrl=$URL&webtitle=$webtitle&listtitle=$listtitle" 
}

Deploying Auto-VPN or Always-On VPN with SSTP

Hi All,

Sorry for the break in blogs about monitoring – I’ve been quite busy with work, so I haven’t had the time to create a monitoring blog. I have been able to create a blog about deploying Always-on VPN, or as Microsoft used to call it “Auto-VPN”. Always-on VPN is going to be the replacement for DirectAccess. DirectAccess was a technology that created 2 hidden VPN tunnels over SSL and encrypted all the data between your client machine and your local network. The downside was that it required Windows Enterprise.

Warning: Long read 🙂
Continue reading

Monitoring with PowerShell Chapter 2: DHCP Pool status

Hi All,

As I’ve explained in my previous the series is taking a bit of a turn here and we’re going to start some blogs about remediation instead of just monitoring. I’ll link back to a previous blog and will explain how we automatically react to these issues within our RMM, if you do not have an RMM – Don’t worry! We’ll include the monitoring + remediation script so you can combine the scripts any way you’d like.

The second monitoring and remediation we’re getting on is a full DHCP-scope and auto-remediate when the scope is completely full. We’ll monitoring several aspects such as the amount of free IP’s, the scope status and lease-time, we’ll also try to clean the scope if it reaches a full state for very old leases or BAD_ADDR’s. Remember that if you bump into this issue a lot it’s better to increase scope size or manage your devices and network 🙂

Continue reading

Monitoring with PowerShell Chapter 2: Hyper-V replication and remediation

Hi All,

As I’ve explained in my previous the series is taking a bit of a turn here and we’re going to start some blogs about remediation instead of just monitoring. I’ll link back to a previous blog and will explain how we automatically react to these issues within our RMM, if you do not have an RMM – Don’t worry! We’ll include the monitoring + remediation script so you can combine the scripts any way you’d like.

The first monitoring and remediation we’re getting on is Hyper-V replication, where we will try to resolve the replication if the server was unreachable for some time, force a resync, and clear the statistics.

Continue reading

Monitoring with PowerShell Chapter 2: Monitoring Windows Activation State

Hi All,
Today we will be focusing on monitoring the status of the Windows and office activation status, we use an imaging application to supply all of our machines with the correct version of Windows, but sometimes its forgotten to actually activate the OS. This script checks the current activation status and alerts on it.

Continue reading

Monitoring with PowerShell Chapter 2: Monitor RDS Security and Licensing status

Hi All,

Today we will be focusing on monitoring the RDS Security layer and licensing status, we often have RDS deployments in which a small oversight happens or the RD-Licensing information is lost. We’ll run a PowerShell script to check if the licensing is set-up correctly, and in what license mode we are running, it will also give us feedback if SSL and NLA are not enabled.
Continue reading

Monitoring with PowerShell Chapter 2: Monitoring Anti-virus installation status

Hi All,
Today we will be focusing on monitoring the anti-virus status of computers or servers that communicate with the Microsoft Security Center, The Security Center WMI Namespace actually has a lot of information about the current state of all security products, as long as they integrate and communicate with WMI.

Continue reading

Monitoring with PowerShell Chapter 2: Monitoring Compellent SANs

Hi All,
Today we will be focusing on monitoring the Compellent SAN status from a single server, Most Compellents are delivered with Dell’s Co-Pilot functionality and do not require you to monitor it yourself, but I also enjoy having an extra set of eyes on my shared storage – Also in some security restricted environments we cannot use the Co-pilot functionality and have to rely on our own monitoring sets.
Continue reading

Blog Series: Monitoring with PowerShell Chapter 2

Hi All,

As the last series of blogs was so well received I’ve decided to continue the trend and make some new blogs about monitoring using PowerShell. I’ll be showing some examples on how monitoring could work in your RMM-suite and will include examples for major RMM suppliers such as Solarwinds.
I hope you’ll enjoy the new series of Monitoring with PowerShell, in the start of Chapter 2 we will be focusing on leveraging PowerShell to monitor external hardware such as Compellent SANs, the status of known exploits such as now famous Meltdown/SPECTRE, and SSL certificates, near the end of this series we will be shifting the focus from monitoring to automated remediation when an issue is found.

I hope you will enjoy the next series of blogs and if you have any questions feel free to drop a comment below.

Blog Series: Monitoring using PowerShell: Part Eight – Monitoring health with PowerShell

Hi All,

My next couple of blogs will be a series of blogs where I will be explaining on how to use PowerShell for the monitoring of critical infrastructure. I will be releasing a blog every day that will touch on how to monitor specific software components, but also network devices from Ubiquity, third-party API’s and Office365. I will also be showing how you can integrate this monitoring in current RMM packages such as Solarwinds N-Central, Solarwinds RMM MSP and even include the required files to import the  monitoring set directly into your system.

Continue reading