List members of a dynamic distribution group
paul | Friday, 20 September 2019 | Office365 | Powershell

A simple powershell script to list the members of a dynamic distribution group in Office 365.

# List members of a dynamic distribution list

Param( 
    [Parameter(Position=0, Mandatory=$true, ValueFromPipeline=$true)] 
    [string] $groupname
) 

if ($Session.state -eq 'Broken' -or !$Session) { 
	write-host "Connecting to Exchange Online Powershell.."
	$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential (Get-Credential) -Authentication Basic -AllowRedirection
	Import-PSSession $Session
}

$Group = Get-DynamicDistributionGroup $groupname
Get-Recipient -RecipientPreviewFilter $Group.RecipientFilter -OrganizationalUnit $Group.RecipientContainer

 

OneDrive automatically syncing libraries
paul | Monday, 16 September 2019 | OneDrive | Sharepoint

Recent versions of OneDrive added the ability to sync Sharepoint libraries automatically using group policy.

Computer Config -> Policies -> Administrative Templates -> OneDrive -> "Configure team site libraries to sync automatically"

The library name must be specified and the library id copied after pressing the sync button in the sharepoint library.

This create the registry entry Software\Policies\Microsoft\OneDrive\TenantAutoMount.

Also File On-Demand feature must be enabled, in OneDrive, for this to work and the update ring must be set to Production and production version installed (does not currently work with Enterprise ring set).

More info here: https://docs.microsoft.com/en-gb/onedrive/use-group-policy#AutoMountTeamSites

Samsung phone error: Customisation Service Stopped
paul | Friday, 06 September 2019 | Android | Samsung

Samsung Phone continually displays the error "Customisation Service Stopped" when on the home screen. The Customisation Service should not be required so can be uninstalled by connecting the phone to a pc, enabling remote debugging, then running the following adb command:

.\adb.exe shell cmd package uninstall -k --user 0 com.samsung.android.rubin.app

Should be ok after the Customisation Service is removed.

Powershell to create m3u playlist files
paul | Thursday, 05 September 2019 | Powershell | mp3

The Powershell script below it create a m3u playlist file for a directory of mp3 files. It will then iterate through every subdirectory creating a playlist file in every folder which contains mp3 files.

# Create M3U Playlist file for each folder of mp3'string

$dirs = dir -Recurse | Where {$_.psIsContainer -eq $true}
foreach ($file in $dirs) {
 $path = $file.fullname
 remove-item "$path\*.m3u" -ea SilentlyContinue -force
 $mp3files = get-childitem -path "$path" | Where-Object {$_.extension -eq ".mp3" -or $_.extension -eq ".wma"} | Sort-Object name | foreach { $_.Name }
 if($mp3files.count -gt 0) {
  $parent = ($file.parent).name | out-string -nonewline
  If($parent.length -gt 3){
	$outfilename = $parent+" - "+$file.name
  }
  else
  {
	$outfilename = $file.name
  }
  $outfilename = $outfilename -replace '\\','_'
  $outfilename = $outfilename -replace '\[','_'
  $outfilename = $outfilename -replace '\]','_'
  $outfile = $path + "\" + $outfilename + ".m3u"
  write-host "Creating M3U ($outfilename.M3U) in [$path]"
  $mp3files | out-file $outfile -Encoding Utf8
 }
}

 

Upgrade Powershell with a single command
paul | Tuesday, 03 September 2019 | Powershell | PS6

The latest version of Powershell (as of September 2019) is v6.2.2. You may have a older version of Powershell installed with your Windows. It can be updated to the latest and greatest version by running the following Powershell comand (as administrator):

iex "& { $(irm https://aka.ms/install-powershell.ps1) } -UseMSI"

You then get the response below:

VERBOSE: About to download package from
'https://github.com/PowerShell/PowerShell/releases/download/v6.2.2/PowerShell-6.2.2-win-x64.msi'

Then the Powershell setup should run.

Thanks to Thomas Maurer @ https://www.thomasmaurer.ch/2019/03/how-to-install-and-update-powershell-6/

Page 1 of 73 (368 Articles) << 1 2 3 4 5  Next >>