Skip to content

Instantly share code, notes, and snippets.

View tomarbuthnot's full-sized avatar

Tom Arbuthnot tomarbuthnot

View GitHub Profile
@tomarbuthnot
tomarbuthnot / LyncServerCertReq
Last active August 29, 2015 14:01
PowerShell to Request and Assign Lync Server Certificates
####################################################
function Get-CertificationAuthority ([string]$CAName)
{
$domain = ([System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain()).Name
$domain = “DC=” + $domain -replace ‘\.’, “, DC=”
$CA = [ADSI]“LDAP://CN=Enrollment Services, CN=Public Key Services, CN=Services, CN=Configuration, $domain”
@tomarbuthnot
tomarbuthnot / Find Disabled Active Directory Accounts Who are Still Lync Enabled
Last active July 12, 2018 18:15
Find Disabled Active Directory Accounts Who are Still Lync Enabled
Find Disabled Active Directory Accounts Who are Still Lync Enabled
# Credit: http://www.ehloworld.com/265
Get-CsAdUser| Where-Object {$_.UserAccountControl -match "AccountDisabled" -and $_.Enabled -eq $true} | Format-Table Name,Enabled,SipAddress -auto
And, if you want, can disable them in one line using
Get-CsAdUser | Where-Object {$_.UserAccountControl -match "AccountDisabled" -and $_.Enabled} | Disable-CsUser -Verbose
@tomarbuthnot
tomarbuthnot / Check for server restart
Created May 26, 2014 17:18
Check for server restart windows event log
get-eventlog system | where-object {$_.eventid -eq 6006} | select -first 10
@tomarbuthnot
tomarbuthnot / Get AD Group Member Names
Created June 2, 2014 10:38
Get AD Group Member Names
$Group = "groupname"
Get-ADGroupMember -Identity "$Group" | Get-ADUser | Select-Object GivenName,Surname,Name
@tomarbuthnot
tomarbuthnot / Get Lync Media Ports (Qos)
Created June 2, 2014 12:51
Get Lync Media Ports (Qos)
Get-CsService -ConferencingServer | fl Identity,*port*
Get-CsService -ApplicationServer | fl Identity,*port*
Get-CsService -MediationServer | fl Identity,*Port*
Get-CsMediaConfiguration | fl
Get-CsUCPhoneConfiguration | fl
Get-CsConferencingConfiguration | fl
# Credit http://guybachar.wordpress.com/2014/05/28/script-lync-qos-quality-of-service-configuration-report/
# Get Extension from TelURI
$LineURI = "$($GetCSUser.LineURI) "
$regex = $LineURI | Select-String -Pattern "tel:\+(?:[0-9]+)+;ext=(?<1>(?:[0-9]+)+)"
$extension = $regex.Matches[0].Groups[1].Value
@tomarbuthnot
tomarbuthnot / gist:0f20304fe25783df77e9
Last active August 29, 2015 14:05
Get Lync Server Component Version Information
Get-ChildItem "HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall" | ForEach-Object {Get-ItemProperty $_.pspath} | Where-Object {($_.DisplayName -imatch "Microsoft Lync Server") -or ($_.DisplayName -imatch "Microsoft Office Web Apps Server 2013") -or ($_.DisplayName -imatch "Unified Communications")} | Sort-Object DisplayVersion -Descending | Select-Object DisplayName,DisplayVersion
@tomarbuthnot
tomarbuthnot / gist:a0b903da2aea0398e454
Created September 9, 2014 19:46
Rename Long Filenames
$longnames = Get-ChildItem -Path "C:\Users\Tom\OneDrive\Documents\Microsoft\Nexthop Archive\" -Recurse | select-object fullname,name, @{Name="Nlength";Expression={$_.Name.Length}} | Where-Object Nlength -GT 35
Foreach ($name in $longnames)
{
$newname = "$($name.Name.Substring(0,6))" + ".html"
Write-Host $newname
Rename-Item -Path $name.Fullname -NewName $newname
}
@tomarbuthnot
tomarbuthnot / gist:1c148a3ad09641f6313d
Created October 8, 2014 15:48
Sort Files by Size PowerShell
Get-ChildItem -Path c:\ -Recurse | Sort-Object Length -Descending | Select-Object length,name,directory -First 100 | Format-Table -AutoSize
Get-Process | Where-Object {$_.ProcessName -eq "Explorer"} | Stop-Process -Force