#skype4b Audit Change Tracking Management?

With the right administrative permissions, a #skype4b administrator can add new or modify existing policies and global configuration settings. Every team member is happy when things go according to plan. If a system-wide or scope-level setting[1] goes awry, your end-users will likely be your most reliable “first level alarm” system. In this case, any remedial actions will visibly affect respective services or users in the firm.

Likewise, a Skype for Business enabled user… Continue reading

#powershell Get-Date v.s. [datetime] Format and System Locale

When a datetime attribute, say whenChanged in Active Directory gets dump to a text file via Export-Csv, the actual object type stored is that of a string. The format saved is dependent on the system locale. Typically for non en-us western locales, the day precedes the month instead of vice versa.

To convert this back to the proper datetime format through Import-Csv, use… Continue reading

#powershell Set-SmbShareAccess ?

Grant-SmbShareAccess is the go-to cmdlet to assign and modify permissions granted to trustees on a Windows NT file share as no Set-SmbShareAccess equipvalent exists.

NOTE
*-SmbShareAccess and related cmdlets are available in PowerShell 4 and higher (Module: SmbShare) and are delivered only with operating systems Windows 8 and Windows Server 2012 (and later versions).

#powershell Grant-SmbShareAccess and Security Groups

Unlike net.exe share, Grant-SmbShareAccess can accept one or more security principals for both user accounts and groups (known as “trustee”) against the -AccountName parameter.

Hence instead of:

#requires -version 4.0
#Windows 8 and Windows Server 2012 or higher
Grant-SmbShareAccess `
-Name sharename`
-AccountName `
(Get-LocalGroupMember groupname).name `
-AccessRight Read -Verbose -Confirm:$false

, simply replace the value against -AccountName with groupname.

#powershell Get-Service StartType Property

Commencing with PowerShell v5, the startup type of a conventional Windows NT service is available as the StartType property with a call to the basic Get-Service cmdlet. Ironically, this property going by the name StartupType is already configuarable pre P5 using Set-Service (local administrative permissions needed).

In prior PS versions, a similar attribute StartMode can only be retrieved using Get-WmiObject plus the -Query or -Filter/-Property parameters:

gwmi -query “Select StartMode from Win32_Service Where Name=’wuauserv'”

gwmi -class Win32_Service -Property StartMode -Filter “Name=’wuauserv'”

Alternatively,

&”$env:windir/system32/sc.exe” qc wuauserv | sls START_TYPE

gives the required value under START_TYPE.

#skype4b #powershell Get-CsWindowsService Missing Service

On a machine with the latest SkypeForBusiness Server 2015 PowerShell module, you successfully execute Get-CsWindowsService directly or remotely by wrapping the former in Invoke-Command with the -ComputerName parameter.

However, you noticed that targeting a Lync Server 2013 Front-End pool may omit some core services such as FabricHostSvc in the result set. This is despite the fact that you explicitly Import-Module Lync in the Invoke-Command statement.

The workaround is to check for the missing service and explicitly run Get-CsWindowsService -ComputerName $server -Name FabricHostSvc.

Note that although you can use Get-Service, the object type is that of ServiceController which differs from NTService returned from Get-CsWindowsService.

#powershell #skype4b Scheduled Task Does Not Work

You tested your #skype4b script from the PowerShell command line and are satisfied that everything works as expected. Next, you create a regular Windows scheduled task to run the script at a specific time of a day. However, you are surprised that no results are returned from simple cmdlets like Get-CsUser. You even wrap similar code in Invoke-Command and purposely target remote hosts with -ComputerName with no success.

Ultimately… Continue reading

#powershell Start-Job -ArgumentList Bug?

Irrespective of the position of -ArgumentList, including the intentional placement at the end of the statement per documentation for Start-Job, a string array will be treated as a single string object when passed to this cmdlet using the aforementioned parameter:

$arr = "a","b","c","d"
Start-Job -ScriptBlock {
param($a) $items = @(); $a | % { $items += $_; }; $items; } -ArgumentList $arr
$result = Receive-Job -id 2
$result
#a
$result.GetType()
#String
$result.count
#1

Continue reading

#skype4b #powershell *-CsDatabase Common Error Messages (and Fix)

Even with the right administrative account and permissions, and proper network as well as firewall (port) settings provisioned, a number of common error messages when working with *-CsDatabase cmdlets in Skype for Business Server prove to be rather challenging to decipher and resolve:

PS C:\> Install-CsDatabase -SqlServerFqdn sql01.leedesmond.com -SqlInstanceName sql01inst01 -Update -ConfiguredDatabases
Install-CsDatabase : Parameter set cannot be resolved using the specified named parameters.
At line:1 char:1
+ Install-CsDatabase -SqlServerFqdn sql01.leedesmond.com -SqlInstanceName sql01inst01 -Update -ConfiguredDatabases
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Install-CsDatabase], ParameterBindingException
+ FullyQualifiedErrorId : AmbiguousParameterSet,Microsoft.Rtc.Management.Deployment.InstallDatabaseCmdlet

Continue reading

#skype4B/Lync #powershell Script: Compare User Policy (Update v1.10)

This revised version of Compare-Skype4BUserPolicy adds the option to include items that hold the same values. It is one of the many PowerShell functions/utilities in my personal script toolbox repository designed to help simplify the management and administration of just about any Lync / Skype for Business Server environments.

Have fun!

################################################################################
# Copyright (c) 201x-2017 leedesmond.com
# All Rights Reserved. Use at your own risk and responsibility.
# Compare-Skype4BUserPolicy.ps1
# Version 1.10
# Continue reading