Skip to content

Instantly share code, notes, and snippets.

View janegilring's full-sized avatar

Jan Egil Ring janegilring

View GitHub Profile
@janegilring
janegilring / Publish-LyncContactInformation.ps1
Created August 8, 2013 06:54
The purpose of Publish-LyncContactInformation is to demonstrate how PowerShell can be used to interact with the Lync SDK. For more information, see the related blog post at blog.powershell.no
#requires -version 2.0
function Publish-LyncContactInformation {
<#
.Synopsis
Publish-LyncContactInformation is a PowerShell function to configure a set of settings in the Microsoft Lync client.
.DESCRIPTION
The purpose of Publish-LyncContactInformation is to demonstrate how PowerShell can be used to interact with the Lync SDK.
Tested with Lync 2013 only.
@janegilring
janegilring / Schedule Publish-LyncContactInformation.ps1
Created August 8, 2013 07:16
An example on how to schedule the Publish-LyncContactInformation function using Register-ScheduledJob introduced in Windows PowerShell 3.0
$cred = Get-Credential
Register-ScheduledJob -Name "Publish-LyncContactInformation - Available" -ScriptBlock {
function Publish-LyncContactInformation {
<#
.Synopsis
Publish-LyncContactInformation is a PowerShell function to configure a set of settings in the Microsoft Lync client.
.DESCRIPTION
@janegilring
janegilring / Get-PrinterDriver.ps1
Last active September 22, 2023 07:39
Demonstration on how to convert the DriverVersion property of Get-PrinterDriver in a readable format.
Get-PrinterDriver | Select-Object Name,@{
n="DriverVersion";e={
$ver = $_.DriverVersion
$rev = $ver -band 0xffff
$build = ($ver -shr 16) -band 0xffff
$minor = ($ver -shr 32) -band 0xffff
$major = ($ver -shr 48) -band 0xffff
"$major.$minor.$build.$rev"
@janegilring
janegilring / Rename-ClusterResource.ps1
Created December 15, 2013 23:38
The Rename-ClusterResource.ps1 script will rename all cluster disks in a Failover Cluster based on the name of the underlying disk volume.
$ClusterDisks = Get-CimInstance -ClassName MSCluster_Resource -Namespace root/mscluster -Filter "type = 'Physical Disk'"
foreach ($Disk in $ClusterDisks) {
$DiskResource = Get-CimAssociatedInstance -InputObject $Disk -ResultClass MSCluster_DiskPartition
if (-not ($DiskResource.VolumeLabel -eq $Disk.Name)) {
Invoke-CimMethod -InputObject $Disk -MethodName Rename -Arguments @{newName = $DiskResource.VolumeLabel}
# Import the module
$RTSPSModule = Join-Path -Path ${env:ProgramFiles(x86)} -ChildPath 'code4ward.net\Royal TS V3\RoyalDocument.PowerShell.dll'
Import-Module $RTSPSModule
# Explore available cmdlets
Get-Command -Module RoyalDocument.PowerShell
# Create a new RoyalStore in memory
$Store = New-RoyalStore -UserName ($env:USERDOMAIN + '\' + $env:USERNAME)
# 1
$Capabilities = @{MilitaryService = $false
DrinkAlcohol = $false
Vote = $false}
# 2
$Capabilities = @{MilitaryService = $false
DrinkAlcohol = $false
Vote = $false}
@janegilring
janegilring / PowerShell_Desktop_5.1.14361.0_new_cmdlets.txt
Created June 9, 2016 16:26
Example output from new cmdlets in PowerShell Desktop 5.1.14361.0
PS C:\> Get-TimeZone
Id : W. Europe Standard Time
DisplayName : (UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna
StandardName : W. Europe Standard Time
DaylightName : W. Europe Daylight Time
BaseUtcOffset : 01:00:00
SupportsDaylightSavingTime : True
@janegilring
janegilring / Install-SysinternalsSuiteNano.ps1
Created July 5, 2016 19:47
This script will download the Nano Server version of the Sysinternals Suite and extract it to the specified target directory.
#requires -Version 5
<#
NAME: Install-SysinternalsSuiteNano.ps1
AUTHOR: Jan Egil Ring (@JanEgilRing)
COMMENT: This script will download the Nano Server version of the Sysinternals Suite and extract it to the specified target directory.
@janegilring
janegilring / Send-ToastyMessage.ps1
Created July 7, 2016 20:52
PowerShell function to send a message to the Toasty app for Windows mobile devices
function Send-ToastyMessage
{
[CmdletBinding()]
param
(
[Parameter(Mandatory=$false)]
[string]
$DeviceID = '337f73c3-9c13-4b34-a2b4-63a14b1d2dd',
[Parameter(Mandatory=$true)]
@janegilring
janegilring / Invoke-OMSAlertDiskCleanup.ps1
Last active July 8, 2016 10:08
This is a demo script intended to be imported as a runbook in Azure Automation to demonstrate the alerts integration between Microsoft Operations Management Suite (OMS) and Azure Automation.
<#
NAME: Invoke-OMSAlertDiskCleanup.ps1
AUTHOR: Jan Egil Ring (@JanEgilRing)
COMMENT: This is a demo script intended to be imported as a runbook in Azure Automation to demonstrate the alerts integration
between Microsoft Operations Management Suite (OMS) and Azure Automation.
The runbook is intended to be run on a Hybrid Runbook Worker.
More information about the context for this demo script is available in this article on PowerShell Magazine: