#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…
#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
#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
#skype4b/lync Hide Share/Presentation Meeting Window (Keyboard Shortcut)
In a conference call using Skype for Business 2016/2015 desktop client, an end-user is only allowed to toggle between Speaker and Gallery view using the left most icon on the top right hand corner of the meeting window. Until someone shares something or makes a PowerPoint presentation, you may have to stare at the (typically low-resolution) overblown photograph of the active speaker or a row of meeting participants’ pictures.
To go back to classic “telephone” audio voice calls with no visual cues of the person speaking whatsoever, you can hit Ctrl+Shift+P on the keyboard to move into Compact View for the Sfb desktop client. This functions apparently only if the Participants window is active otherwise the Gallery view will be shown.
#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
#