Skip to content

Instantly share code, notes, and snippets.

@amandadebler
amandadebler / Get-AudioCodesSBAVersion.ps1
Created May 16, 2016 07:38
Gets the version of all the SBAs in your Lync/Skype for Business topology using their web interfaces, so it works even if they're locked down. Only works for AudioCodes SBAs so far.
(Get-CsPool).where({$_.services -like "*registrar*" -and $_.services.where({$_ -like "WebServer*"}).count -eq 0}).computers | foreach { (Invoke-WebRequest -Uri "http://$_/Home/LogOn").content -match "(1\.\d+\.\d+\.\d+)" | out-null; [pscustomobject]@{PSTypeName='SBAVersion'; ComputerName = $_; Version = $matches[0] } }
@amandadebler
amandadebler / Get-SkypeServersByRole.ps1
Last active June 3, 2016 10:00
Snippets to get a list of computers by role in Skype for Business/Lync topology
$SBAs = (Get-CsPool).where({$_.services -like "*registrar*" -and $_.services.where({$_ -like "WebServer*"}).count -eq 0}).computers
$frontEndServers = (Get-CsPool).where({$_.services -like "*registrar*" -and $_.services -like "Conferencing*"}).computers
$directorServers = (Get-CsPool).where({$_.services -like "*registrar*" -and $_.services -like "WebServer*" -and $_.services.where({$_ -like "Conferencing*"}).count -eq 0}).computers
$mediationServers = (Get-CsPool).where({$_.services -like "*Mediation*" -and $_.services.where({$_ -like "registrar*"}).count -eq 0}).computers
$edgeServers = (Get-CsPool).where({$_.services -like "*Edge*"}).computers
# Limitation: does not explore the Office Web Apps Farm for individual servers
$OfficeWebAppServers = (Get-cspool).where({$_.services -like "*WacServer*"}).computers
# Filters out backup PSTN trunks to pair gateways with secondard Mediation Services - only shows PSTN trunks with "real" FQDNs
@amandadebler
amandadebler / Get-UMExtensionFromSkype.ps1
Last active June 15, 2016 13:57
Finding who has an extension on their Exchange UM mailbox when they don't have it on their Skype Line URI
<# Who has that Exchange UM extension?
The error when attempting to Enable-UMMailbox:
Extension 2233 is already assigned to another user on dial plan Nuremberg or on an equivalent dial
plan.
Get-CsAdPrincipal continues to be FAST: about 40-50ms against my real-life 40k+ user AD
#>
Get-CsAdPrincipal -LDAPFilter '(proxyAddresses=eum:2233;phone-context=Nuremberg.mandie.net)'
@amandadebler
amandadebler / NewCsAnalogDevice.ps1
Last active July 16, 2016 10:36
Create a new CsAnalogDevice to integrate an outside phone number into Skype for Business
New-CsAnalogDevice -LineURI 'tel:+4915112345678' -DisplayName 'Maintenance Crew' `
-OU 'mandie.net/Contacts/Phones' -Gateway 'nue-sbc01.mandie.net' -SipAddress `
'sip:[email protected]' -RegistrarPool 'nue-FE01.mandie.net' `
-AnalogFax:$false -DomainController nue-dc01
@amandadebler
amandadebler / BootlegSkypeTopology.ps1
Last active February 28, 2017 17:24
Getting Skype server-related info with only read access to Active Directory
# Using native AD module
$configurationContainer = 'CN=Configuration,'+ (((get-adforest).name.split('.') | foreach {"DC=$_"}) -join ',')
# All pools, whether Director, FrontEnd or SBA
$rawPools = get-adobject -LDAPFilter '(objectClass=msrtcsip-pool)' -SearchBase $configurationContainer -Properties 'name','dnshostname','msrtcsip-pooldata','msrtcsip-pooldisplayname','distinguishedname'
# An entry for each combination of pool or member server and several service types
$trustedServices = get-adobject -LDAPFilter '(objectclass=msrtcsip-trustedservice)' -SearchBase $configurationContainer -Properties 'msrtcsip-routingpooldn','msrtcsip-trustedServerFQDN','msrtcsip-trustedserviceport','msrtcsip-trustedservicetype'
# All pools and their member servers (if Enterprise)
@amandadebler
amandadebler / PowerShellAutomaticVariables.txt
Created April 21, 2017 13:11
Variables listed in about_automatic_variables, without initial $
$
?
^
_
ARGS
CONSOLEFILENAME
ERROR
EVENT
EVENTARGS
EVENTSUBSCRIBER
@amandadebler
amandadebler / BootlegSkypeObjects.ps1
Last active May 11, 2017 12:42
More Bootleg fun, this time with Users and other Endpoints - No Skype Admin required!
function Get-BootlegAllUsers {
# This is 2.5 times faster than Get-ADUser -LDAPFilter '(&(msrtcsip-primaryuseraddress=*)(!msrtcsip-ownerurn=*))'
Get-ADObject -LDAPFilter '(&(msrtcsip-userenabled=TRUE)(&(objectclass=User)(!msrtcsip-ownerurn=*)))' -Properties 'msrtcsip-line','msrtcsip-privateline',displayName,'msrtcsip-primaryuseraddress' | Select-Object -Property name, displayName, @{n='PhoneNumber';e={$_.'msrtcsip-line'}}, @{n='PrivateLine';e={$_.'msrtcsip-privateline'}}, @{n='SIPAddress';e={$_.'msrtcsip-primaryuseraddress'}}
}
function Get-BootlegAllCommonAreaPhones {
Get-ADObject -LDAPFilter '(&(msrtcsip-userenabled=TRUE)(&(objectclass=Contact)(msrtcsip-ownerurn=urn:device:commonareaphone)))'
}
# Includes default RGS objects; filter for things that have a phone number if you only want "real" ones
@amandadebler
amandadebler / BootlegPowerShellGet.psm1
Last active October 16, 2019 18:34 — forked from Jaykul/PowerShellGet.psm1
PowerShell Gallery Module - Bootleg Edition
<#
Forked from https://github.com/jaykul Gist, posted in response to my Twitter
whinge about PowerShellGet in the enterprise - Thank you, Joel Bennett!
This adds the ability to use a web proxy, using your current session's
credentials. Might add option to use other credentials, if there's demand.
It also adds a 'BL' (Bootleg) prefix to the nouns, just to prevent confusion with the "real"
cmdlets. Feel free to remove them.
$AllProtocols = [System.Net.SecurityProtocolType]'Ssl3,Tls,Tls11,Tls12'
[System.Net.ServicePointManager]::SecurityProtocol = $AllProtocols
Add-Type -AssemblyName System.Web
Add-Type -AssemblyName system.Security
Add-Type -AssemblyName System
Add-Type @"
using System.Net;
using System.Security.Cryptography.X509Certificates;
public class TrustAllCertsPolicy : ICertificatePolicy {
@amandadebler
amandadebler / bamf_histograms
Last active January 26, 2019 14:06 — forked from ynux/bamf_histograms
English translation of refugee-datathon-muc.de landing page
<p>On this page, we present the <a href="http://www.bamf.de/DE/Infothek/Statistiken/Asylzahlen/Asylgeschäftsstatistik/asylgeschaeftsstatistik-node.html">decision statistics of the BAMF</a> (Bundesagentur für Migration und Flüchtlinge - German federal agency for immigration and refugees) as histograms. They are supplemented monthly, at present most of them go through October. The new statistics should be published in the middle of the following month; the webpage is usually updated by the end of the month. Recent data and the numbers for countries from which fewer asylum seekers come can be found here: <a href="https://refugee-datathon-muc.de/?page_id=913">Interactive Dashboard</a> .</p>
<p>For each country, we offer the link to the latest German national report from Amnesty International. The graphics for 2015 to 2016 can be found for most countries on <a href="https://refugee-datathon-muc.de/?page_id=376">this page (German only)</a> &nbsp;</p>
<p><a href="#Afghanistan">Afghanistan</a> | <a href="#Syrien">Syr