none
Lync provisioning using MIMWAL RRS feed

Answers

  • We have used following MIMWAL workflow for SFB user account provisioning

    -------------------------------------------------------------------------------------------

    param

    (
           [parameter(mandatory = $true)] $AccountName
           ,[parameter(mandatory = $true)] $EmailAddress
    )

    function InvokeImmediateTermination
    {
        $stdOutFile = Join-Path $env:TEMP -ChildPath "StdOut_$AECRequestId.log"
        $stdErrFile = Join-Path $env:TEMP -ChildPath "StdErr_$AECRequestId.log"

        $command = @"
        & {
            if (!(Get-Module -Name "SkypeforBusiness"))
            {
                Import-Module SkypeforBusiness
            }

            Enable-CsUser -Identity "$AccountName" -RegistrarPool "lync.shashicloud.in" -SipAddress "sip:$EmailAddress"

            if (`$Error.Count -eq 0)
            {
                "!!Success!!"
            }
            else
            {
                # Can't easily use stdErrFile as it comes as CLIXML and includes Warning/Verbose/Debug streams as well. So we'll simply use stdOutFile
                `$Error
            }
        }
    "@

        Write-Debug $command

        $commandBytes = [System.Text.Encoding]::Unicode.GetBytes($command)
        $encodedCommand = [Convert]::ToBase64String($commandBytes)

        Start-Process 'PowerShell.exe' `
            -ArgumentList "-Version 3.0 -NonInteractive -OutputFormat Text -EncodedCommand $encodedCommand" `
            -RedirectStandardOutput $stdOutFile `
            -RedirectStandardError $stdErrFile `
            -Wait

        $statusLine = Get-Content $stdOutFile| Select-Object -Last 2 | ? {
            $_.Contains("!!Success!!")
        }
           
        if ([string]::IsNullOrEmpty($statusLine))
        {
            throw $((Get-Content $stdOutFile) -join "`r`n")
        }
        else
        {
            Write-Debug "Script executed successfully."
        }

        Remove-Item $stdOutFile -Force
        Remove-Item $stdErrFile -Force
    }

    InvokeImmediateTermination


    Monday, March 12, 2018 9:55 AM

All replies

  • It depends how you want to provision Lync.

    We really can't help you with this kind of information!

    Wednesday, February 21, 2018 10:11 AM
  • We have used following MIMWAL workflow for SFB user account provisioning

    -------------------------------------------------------------------------------------------

    param

    (
           [parameter(mandatory = $true)] $AccountName
           ,[parameter(mandatory = $true)] $EmailAddress
    )

    function InvokeImmediateTermination
    {
        $stdOutFile = Join-Path $env:TEMP -ChildPath "StdOut_$AECRequestId.log"
        $stdErrFile = Join-Path $env:TEMP -ChildPath "StdErr_$AECRequestId.log"

        $command = @"
        & {
            if (!(Get-Module -Name "SkypeforBusiness"))
            {
                Import-Module SkypeforBusiness
            }

            Enable-CsUser -Identity "$AccountName" -RegistrarPool "lync.shashicloud.in" -SipAddress "sip:$EmailAddress"

            if (`$Error.Count -eq 0)
            {
                "!!Success!!"
            }
            else
            {
                # Can't easily use stdErrFile as it comes as CLIXML and includes Warning/Verbose/Debug streams as well. So we'll simply use stdOutFile
                `$Error
            }
        }
    "@

        Write-Debug $command

        $commandBytes = [System.Text.Encoding]::Unicode.GetBytes($command)
        $encodedCommand = [Convert]::ToBase64String($commandBytes)

        Start-Process 'PowerShell.exe' `
            -ArgumentList "-Version 3.0 -NonInteractive -OutputFormat Text -EncodedCommand $encodedCommand" `
            -RedirectStandardOutput $stdOutFile `
            -RedirectStandardError $stdErrFile `
            -Wait

        $statusLine = Get-Content $stdOutFile| Select-Object -Last 2 | ? {
            $_.Contains("!!Success!!")
        }
           
        if ([string]::IsNullOrEmpty($statusLine))
        {
            throw $((Get-Content $stdOutFile) -join "`r`n")
        }
        else
        {
            Write-Debug "Script executed successfully."
        }

        Remove-Item $stdOutFile -Force
        Remove-Item $stdErrFile -Force
    }

    InvokeImmediateTermination


    Monday, March 12, 2018 9:55 AM