Rotate an image n number of times

function AnimateRotate(angle, repeat, elemn) {

 

    var duration = 1000;

    setTimeout(function () {

        if (repeat && repeat == “infinite”) {

            AnimateRotate(angle, repeat, elemn);

        } else if (repeat && repeat > 1) {

            AnimateRotate(angle, repeat – 1, elemn);

        }

    }, duration)

    var $elem = elemn;

    $({ deg: 0 }).animate({ deg: angle }, {

        duration: duration,

        step: function (now) {

            $elem.css({

                ‘transform’: ‘rotate(‘ + now + ‘deg)’

            });

        }

    });

}

 

function ShowRefreshError() {

 

    var element = document.createElement(‘div’);

    var refresherror =

+

        ‘  If the problem persists, please contact the HelpDesk +

       


+

        ‘</div>’;

    element.innerHTML = refresherror;

 

    var options = {

        html: element,

        title: ‘Refresh Failed.’,

        allowMaximize: false,

        showClose: false,

        autoSize: true

    };

 

    SP.SOD.execute(‘sp.ui.dialog.js’, ‘SP.UI.ModalDialog.showModalDialog’, options);

}

 

RefreshLink = function () {

 

    var elemn = $(“a[title|=’Refresh] > img”);

    AnimateRotate(360, 2, elemn);

 

    $.ajax({

        cache: false,

        type: “GET”,

        url: https://google.com?webAddress,

        crossDomain: true,

        xhrFields: {

            withCredentials: true

        },

        success: function (data) {

            }

            else {

                ShowRefreshError();

            }

        },

        error: function (status, error) {

            ShowRefreshError();

        }

    });

};

 

 

 

Leave a comment

Fixing: The client and server cannot communicate, because they do not possess a common algorithm

A connection was successfully established with the server, but then an error occurred during the pre-login handshake. (provider: SSL Provider, error: 0 – The client and server cannot communicate, because they do not possess a common algorithm.) (Microsoft SQL Server, Error: -2146893007)”

run below PS in your server, I got it from somewhere from internet. which fixed my servers
note: it will ask for restart.




# Copyright 2016, Alexander Hass
# http://www.hass.de/content/setup-your-iis-ssl-perfect-forward-secrecy-and-tls-12
#
# Version 1.7
# – Windows Version compare failed. Get-CimInstance requires Windows 2012 or later.
# Version 1.6
# – OS version detection for cipher suites order.
# Version 1.5
# – Enabled ECDH and more secure hash functions and reorderd cipher list.
# – Added Client setting for all ciphers.
# Version 1.4
# – RC4 has been disabled.
# Version 1.3
# – MD5 has been disabled.
# Version 1.2
# – Re-factored code style and output
# Version 1.1
# – SSLv3 has been disabled. (Poodle attack protection)

Write-Host ‘Configuring IIS with SSL/TLS Deployment Best Practices…’
Write-Host ‘——————————————————————————–‘

# Disable Multi-Protocol Unified Hello
New-Item ‘HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\Multi-Protocol Unified Hello\Server’ -Force | Out-Null
New-ItemProperty -path ‘HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\Multi-Protocol Unified Hello\Server’ -name Enabled -value 0 -PropertyType ‘DWord’ -Force | Out-Null
New-ItemProperty -path ‘HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\Multi-Protocol Unified Hello\Server’ -name ‘DisabledByDefault’ -value 1 -PropertyType ‘DWord’ -Force | Out-Null
New-Item ‘HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\Multi-Protocol Unified Hello\Client’ -Force | Out-Null
New-ItemProperty -path ‘HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\Multi-Protocol Unified Hello\Client’ -name Enabled -value 0 -PropertyType ‘DWord’ -Force | Out-Null
New-ItemProperty -path ‘HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\Multi-Protocol Unified Hello\Client’ -name ‘DisabledByDefault’ -value 1 -PropertyType ‘DWord’ -Force | Out-Null
Write-Host ‘Multi-Protocol Unified Hello has been disabled.’

# Disable PCT 1.0
New-Item ‘HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\PCT 1.0\Server’ -Force | Out-Null
New-ItemProperty -path ‘HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\PCT 1.0\Server’ -name Enabled -value 0 -PropertyType ‘DWord’ -Force | Out-Null
New-ItemProperty -path ‘HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\PCT 1.0\Server’ -name ‘DisabledByDefault’ -value 1 -PropertyType ‘DWord’ -Force | Out-Null
New-Item ‘HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\PCT 1.0\Client’ -Force | Out-Null
New-ItemProperty -path ‘HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\PCT 1.0\Client’ -name Enabled -value 0 -PropertyType ‘DWord’ -Force | Out-Null
New-ItemProperty -path ‘HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\PCT 1.0\Client’ -name ‘DisabledByDefault’ -value 1 -PropertyType ‘DWord’ -Force | Out-Null
Write-Host ‘PCT 1.0 has been disabled.’

# Disable SSL 2.0 (PCI Compliance)
New-Item ‘HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 2.0\Server’ -Force | Out-Null
New-ItemProperty -path ‘HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 2.0\Server’ -name Enabled -value 0 -PropertyType ‘DWord’ -Force | Out-Null
New-ItemProperty -path ‘HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 2.0\Server’ -name ‘DisabledByDefault’ -value 1 -PropertyType ‘DWord’ -Force | Out-Null
New-Item ‘HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 2.0\Client’ -Force | Out-Null
New-ItemProperty -path ‘HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 2.0\Client’ -name Enabled -value 0 -PropertyType ‘DWord’ -Force | Out-Null
New-ItemProperty -path ‘HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 2.0\Client’ -name ‘DisabledByDefault’ -value 1 -PropertyType ‘DWord’ -Force | Out-Null
Write-Host ‘SSL 2.0 has been disabled.’

# NOTE: If you disable SSL 3.0 the you may lock out some people still using
# Windows XP with IE6/7. Without SSL 3.0 enabled, there is no protocol available
# for these people to fall back. Safer shopping certifications may require that
# you disable SSLv3.
#
# Disable SSL 3.0 (PCI Compliance) and enable “Poodle” protection
New-Item ‘HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 3.0\Server’ -Force | Out-Null
New-ItemProperty -path ‘HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 3.0\Server’ -name Enabled -value 0 -PropertyType ‘DWord’ -Force | Out-Null
New-ItemProperty -path ‘HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 3.0\Server’ -name ‘DisabledByDefault’ -value 1 -PropertyType ‘DWord’ -Force | Out-Null
New-Item ‘HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 3.0\Client’ -Force | Out-Null
New-ItemProperty -path ‘HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 3.0\Client’ -name Enabled -value 0 -PropertyType ‘DWord’ -Force | Out-Null
New-ItemProperty -path ‘HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 3.0\Client’ -name ‘DisabledByDefault’ -value 1 -PropertyType ‘DWord’ -Force | Out-Null
Write-Host ‘SSL 3.0 has been disabled.’

# Add and Enable TLS 1.0 for client and server SCHANNEL communications
New-Item ‘HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.0\Server’ -Force | Out-Null
New-ItemProperty -path ‘HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.0\Server’ -name ‘Enabled’ -value ‘0xffffffff’ -PropertyType ‘DWord’ -Force | Out-Null
New-ItemProperty -path ‘HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.0\Server’ -name ‘DisabledByDefault’ -value 0 -PropertyType ‘DWord’ -Force | Out-Null
New-Item ‘HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.0\Client’ -Force | Out-Null
New-ItemProperty -path ‘HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.0\Client’ -name ‘Enabled’ -value ‘0xffffffff’ -PropertyType ‘DWord’ -Force | Out-Null
New-ItemProperty -path ‘HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.0\Client’ -name ‘DisabledByDefault’ -value 0 -PropertyType ‘DWord’ -Force | Out-Null
Write-Host ‘TLS 1.0 has been enabled.’

# Add and Enable TLS 1.1 for client and server SCHANNEL communications
New-Item ‘HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.1\Server’ -Force | Out-Null
New-ItemProperty -path ‘HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.1\Server’ -name ‘Enabled’ -value ‘0xffffffff’ -PropertyType ‘DWord’ -Force | Out-Null
New-ItemProperty -path ‘HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.1\Server’ -name ‘DisabledByDefault’ -value 0 -PropertyType ‘DWord’ -Force | Out-Null
New-Item ‘HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.1\Client’ -Force | Out-Null
New-ItemProperty -path ‘HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.1\Client’ -name ‘Enabled’ -value ‘0xffffffff’ -PropertyType ‘DWord’ -Force | Out-Null
New-ItemProperty -path ‘HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.1\Client’ -name ‘DisabledByDefault’ -value 0 -PropertyType ‘DWord’ -Force | Out-Null
Write-Host ‘TLS 1.1 has been enabled.’

# Add and Enable TLS 1.2 for client and server SCHANNEL communications
New-Item ‘HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Server’ -Force | Out-Null
New-ItemProperty -path ‘HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Server’ -name ‘Enabled’ -value ‘0xffffffff’ -PropertyType ‘DWord’ -Force | Out-Null
New-ItemProperty -path ‘HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Server’ -name ‘DisabledByDefault’ -value 0 -PropertyType ‘DWord’ -Force | Out-Null
New-Item ‘HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client’ -Force | Out-Null
New-ItemProperty -path ‘HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client’ -name ‘Enabled’ -value ‘0xffffffff’ -PropertyType ‘DWord’ -Force | Out-Null
New-ItemProperty -path ‘HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client’ -name ‘DisabledByDefault’ -value 0 -PropertyType ‘DWord’ -Force | Out-Null
Write-Host ‘TLS 1.2 has been enabled.’

# Re-create the ciphers key.
New-Item ‘HKLM:SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Ciphers’ -Force | Out-Null

# Disable insecure/weak ciphers.
$insecureCiphers = @(
  ‘DES 56/56’,
  ‘NULL’,
  ‘RC2 128/128’,
  ‘RC2 40/128’,
  ‘RC2 56/128’,
  ‘RC4 40/128’,
  ‘RC4 56/128’,
  ‘RC4 64/128’,
  ‘RC4 128/128’
)
Foreach ($insecureCipher in $insecureCiphers) {
  $key = (Get-Item HKLM:\).OpenSubKey(‘SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Ciphers’, $true).CreateSubKey($insecureCipher)
  $key.SetValue(‘Enabled’, 0, ‘DWord’)
  $key.close()
  Write-Host “Weak cipher $insecureCipher has been disabled.”
}

# Enable new secure ciphers.
# – RC4: It is recommended to disable RC4, but you may lock out WinXP/IE8 if you enforce this. This is a requirement for FIPS 140-2.
# – 3DES: It is recommended to disable these in near future. This is the last cipher supported by Windows XP.
# – Windows Vista and before ‘Triple DES 168’ was named ‘Triple DES 168/168’ per https://support.microsoft.com/en-us/kb/245030
$secureCiphers = @(
  ‘AES 128/128’,
  ‘AES 256/256’,
  ‘Triple DES 168’
)
Foreach ($secureCipher in $secureCiphers) {
  $key = (Get-Item HKLM:\).OpenSubKey(‘SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Ciphers’, $true).CreateSubKey($secureCipher)
  New-ItemProperty -path “HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Ciphers\$secureCipher” -name ‘Enabled’ -value ‘0xffffffff’ -PropertyType ‘DWord’ -Force | Out-Null
  $key.close()
  Write-Host “Strong cipher $secureCipher has been enabled.”
}

# Set hashes configuration.
New-Item ‘HKLM:SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Hashes’ -Force | Out-Null
New-Item ‘HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Hashes\MD5’ -Force | Out-Null
New-ItemProperty -path ‘HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Hashes\MD5’ -name Enabled -value 0 -PropertyType ‘DWord’ -Force | Out-Null

$secureHashes = @(
  ‘SHA’,
  ‘SHA256’,
  ‘SHA384’,
  ‘SHA512’
)
Foreach ($secureHash in $secureHashes) {
  $key = (Get-Item HKLM:\).OpenSubKey(‘SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Hashes’, $true).CreateSubKey($secureHash)
  New-ItemProperty -path “HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Hashes\$secureHash” -name ‘Enabled’ -value ‘0xffffffff’ -PropertyType ‘DWord’ -Force | Out-Null
  $key.close()
  Write-Host “Hash $secureHash has been enabled.”
}

# Set KeyExchangeAlgorithms configuration.
New-Item ‘HKLM:SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\KeyExchangeAlgorithms’ -Force | Out-Null
$secureKeyExchangeAlgorithms = @(
  ‘Diffie-Hellman’,
  ‘ECDH’,
  ‘PKCS’
)
Foreach ($secureKeyExchangeAlgorithm in $secureKeyExchangeAlgorithms) {
  $key = (Get-Item HKLM:\).OpenSubKey(‘SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\KeyExchangeAlgorithms’, $true).CreateSubKey($secureKeyExchangeAlgorithm)
  New-ItemProperty -path “HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\KeyExchangeAlgorithms\$secureKeyExchangeAlgorithm” -name ‘Enabled’ -value ‘0xffffffff’ -PropertyType ‘DWord’ -Force | Out-Null
  $key.close()
  Write-Host “KeyExchangeAlgorithm $secureKeyExchangeAlgorithm has been enabled.”
}

# Set cipher suites order as secure as possible (Enables Perfect Forward Secrecy).
$os = Get-WmiObject -class Win32_OperatingSystem
if ([System.Version]$os.Version -lt [System.Version]’10.0′) {
  Write-Host ‘Use cipher suites order for Windows 2008/2008R2/2012/2012R2.’
  $cipherSuitesOrder = @(
    ‘TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P521’,
    ‘TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384’,
    ‘TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256’,
    ‘TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P521’,
    ‘TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P384’,
    ‘TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256’,
    ‘TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P521’,
    ‘TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384’,
    ‘TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P256’,
    ‘TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA_P521’,
    ‘TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA_P384’,
    ‘TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA_P256’,
    ‘TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384_P521’,
    ‘TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384_P384’,
    ‘TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256_P521’,
    ‘TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256_P384’,
    ‘TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256_P256’,
    ‘TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384_P521’,
    ‘TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384_P384’,
    ‘TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256_P521’,
    ‘TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256_P384’,
    ‘TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256_P256’,
    ‘TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA_P521’,
    ‘TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA_P384’,
    ‘TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA_P256’,
    ‘TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA_P521’,
    ‘TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA_P384’,
    ‘TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA_P256’,
    ‘TLS_RSA_WITH_AES_256_GCM_SHA384’,
    ‘TLS_RSA_WITH_AES_128_GCM_SHA256’,
    ‘TLS_RSA_WITH_AES_256_CBC_SHA256’,
    ‘TLS_RSA_WITH_AES_128_CBC_SHA256’,
    ‘TLS_RSA_WITH_AES_256_CBC_SHA’,
    ‘TLS_RSA_WITH_AES_128_CBC_SHA’,
    ‘TLS_RSA_WITH_3DES_EDE_CBC_SHA’
  )
}
else {
  Write-Host ‘Use cipher suites order for Windows 10/2016 and later.’
  $cipherSuitesOrder = @(
    ‘TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384’,
    ‘TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256’,
    ‘TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384’,
    ‘TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256’,
    ‘TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA’,
    ‘TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA’,
    ‘TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384’,
    ‘TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256’,
    ‘TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384’,
    ‘TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256’,
    ‘TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA’,
    ‘TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA’,
    ‘TLS_RSA_WITH_AES_256_GCM_SHA384’,
    ‘TLS_RSA_WITH_AES_128_GCM_SHA256’,
    ‘TLS_RSA_WITH_AES_256_CBC_SHA256’,
    ‘TLS_RSA_WITH_AES_128_CBC_SHA256’,
    ‘TLS_RSA_WITH_AES_256_CBC_SHA’,
    ‘TLS_RSA_WITH_AES_128_CBC_SHA’,
    ‘TLS_RSA_WITH_3DES_EDE_CBC_SHA’
  )
}
$cipherSuitesAsString = [string]::join(‘,’, $cipherSuitesOrder)
# One user reported this key does not exists on Windows 2012R2. Cannot repro myself on a brand new Windows 2012R2 core machine. Adding this just to be save.
New-Item ‘HKLM:\SOFTWARE\Policies\Microsoft\Cryptography\Configuration\SSL\00010002’ -ErrorAction SilentlyContinue
New-ItemProperty -path ‘HKLM:\SOFTWARE\Policies\Microsoft\Cryptography\Configuration\SSL\00010002’ -name ‘Functions’ -value $cipherSuitesAsString -PropertyType ‘String’ -Force | Out-Null

Write-Host ‘——————————————————————————–‘
Write-Host ‘NOTE: After the system has been rebooted you can verify your server’
Write-Host ‘      configuration at https://www.ssllabs.com/ssltest/&#8217;
Write-Host “——————————————————————————–`n”

Write-Host -ForegroundColor Red ‘A computer restart is required to apply settings. Restart computer now?’

Restart-Computer -Force -Confirm
Leave a comment

Powershell to add dummy documents to SharePoint List for Testing purpose

Write-Host “Loading SharePoint Powershell Snapin”
$snapin = Get-PSSnapin | Where-Object {$_.Name -eq ‘Microsoft.SharePoint.Powershell’} 
if ($snapin -eq $null) {  Add-PSSnapin “Microsoft.SharePoint.Powershell” }

# —- Script settings —-
$sourceDocumentPath = “C:\temp\TestDoc.docx” # Source document to spawn new documents from for the creation
$newFilenamePrefix = “TestDoc”
$newFilenameExtension = “.docx”
$numberDocsToCreate = 5000

# Settings for the destination to create documents in

$webUrl = “http://site:1111/sites/tdm3&#8221;
$docLibraryName = “Lib”
$folderPathWithinDocLibrary = “” # Leave empty e.g. “” to create documents in root folder of library otherwise specify path relative to root folder e.g. “/Testing/Folder A”

# ————————-

#Open web and library
$web = Get-SPWeb $webUrl
$docLibrary = $web.Lists[$docLibraryName]
$docLibraryUrl = $docLibrary.RootFolder.ServerRelativeUrl
$uploadfolder = $web.getfolder($docLibraryUrl + $folderPathWithinDocLibrary)

#Open file
$file = get-item $sourceDocumentPath
$fileStream = ([System.IO.FileInfo] (Get-Item $file.FullName)).OpenRead()

# Create documents in SharePoint
write-host “Creating $i documents based on the file $sourceDocumentPath”

for($i=1; $i -le $numberDocsToCreate; $i++)
{
$newFilePath = $docLibraryUrl + $folderPathWithinDocLibrary + “/” + $newFilenamePrefix+$i+$newFilenameExtension
write-host “Creating document: $newFilePath …”
$spFile = $uploadfolder.Files.Add($newFilePath, [System.IO.Stream]$fileStream, $true)
}

write-host “Completed”

#Close file stream
$fileStream.Close()

#Dispose web
$web.Dispose()

Posted in Bulk load Documents, Powershell, SharePoint document library, upload document | Leave a comment

Schedule Nintex Workflows to ListItems via Nintex web service

Small Utility to Schedule Nintex Workflows to SharePoint ListItems via Nintex web service

internal class Program
    {
        private static void Main(string[] args)
        {
            var sourceListName = “EIQ”; //
            var siteUrl = “http://site:3333&#8221;;
            var UserName = “dtu”;
            var pwd = “Password10”;
            var domain = “dev”;
            string env = “DEV”;
            string workflowName = “IncompleteForm_WF”;
            try
            {
                ClientContext clientContext = null;
                if (env.ToUpper() == “DEV”)
                {
                    clientContext = Auth(siteUrl, UserName, pwd, domain);
                }
                else if (env.ToUpper() == “UAT”)
                {
                    clientContext = MixedAuthRequest(siteUrl, UserName, pwd, domain);
                }

                NintexWorkflowWSSoapClient soapClient = InitializeNintexSoapClienn(UserName, pwd, domain);
                Microsoft.SharePoint.Client.User spUser;
                spUser = clientContext.Web.CurrentUser;
                Console.WriteLine(“Loading User!”);
                clientContext.Load(spUser, user => user.LoginName);
                Console.WriteLine(“Loading Login Name”);
                clientContext.ExecuteQuery();
                Console.WriteLine(spUser.LoginName);
                //Process EID list items
                ProcessEIQItems(clientContext, sourceListName, soapClient, workflowName);
                Console.ReadLine();
            }
            catch (Exception ex)
            {

                string message = “Error in main method”;
                Console.WriteLine(message);
                ErrorLogging(ex, message);
                Console.ReadLine();
            }
        }

        private static NintexWorkflowWSSoapClient InitializeNintexSoapClienn(string UserName, string pwd, string domain)
        {
            try
            {
                var soapClient = new NintexWorkflowWSSoapClient(“NintexWorkflowWSSoap”);
                //need to name the endpoint being used.
                soapClient.ClientCredentials.Windows.ClientCredential.UserName = UserName;
                soapClient.ClientCredentials.Windows.ClientCredential.Password = pwd;
                soapClient.ClientCredentials.Windows.ClientCredential.Domain = domain; //optional
                                                                                       //soapClient.ClientCredentials.Windows.AllowNtlm = true; //optional
                soapClient.ClientCredentials.Windows.AllowedImpersonationLevel = TokenImpersonationLevel.Impersonation; //optional
                return soapClient;
            }
            catch (Exception ex)
            {
                string message = “Error in Initialising the Nintexwebservice soap method”;
                Console.WriteLine(message);
                ErrorLogging(ex, message);
                throw ex;
            }
        }

        private static void ProcessEIQItems(ClientContext clientContext, string listName, NintexWorkflowWSSoapClient soapClient, string workflowName)
        {
            ListItemCollection olistItems = null; 
            try
            {
                Microsoft.SharePoint.Client.List oList = clientContext.Web.Lists.GetByTitle(listName);
                CamlQuery query = new CamlQuery();
                query.ViewXml = string.Format(“true” +
                    “

“);
                olistItems = oList.GetItems(query);
                clientContext.Load(olistItems);
                clientContext.ExecuteQuery();
                if (olistItems != null && olistItems.Count > 0)
                {
                    foreach (ListItem listItem in olistItems)
                    {
                        var strDate = Convert.ToDateTime(listItem[“NextReminderDate”].ToString());
                        if (strDate != null)
                        {
                            ScheduleNintexWrorkflow(listName, soapClient, workflowName, listItem, strDate);
                        }
                    }

                }
            }
            catch (Exception ex)
            {
                string message = “Error in ProcessEIQItems method”;
                Console.WriteLine(message);
                ErrorLogging(ex, message);
                throw ex;
            }
        }

        private static void ScheduleNintexWrorkflow(string listName, NintexWorkflowWSSoapClient soapClient, string workflowName, ListItem listItem, DateTime strDate)
        {
            try
            {             
                Schedule sc = new Schedule();
                sc.StartTime = strDate;
                RepeatInterval ri = new RepeatInterval();
                ri.CountBetweenIntervals = 14;
                ri.Type = RepeatIntervalType.Hourly;
                sc.RepeatInterval = ri;
                sc.MaximumRepeats = 0;
                sc.WorkdaysOnly = false;
                sc.EndOn = EndScheduleOn.RepeatCount;
                var ret = soapClient.AddWorkflowScheduleOnListItem(Convert.ToInt32(listItem[“ID”]), listName, workflowName, “”, sc, true);
            }
            catch (Exception ex)
            {
                string message = “Error in Scheduling the item ID: ” + Convert.ToString(listItem[“ID”]);
                Console.WriteLine(message);
                ErrorLogging(ex, message);
            }
        }

        public static void ErrorLogging(Exception ex, string message)
        {
            string strPath = @”D:\NintexScheuldeWFLog.txt”;
            if (!System.IO.File.Exists(strPath))
            {
                System.IO.File.Create(strPath).Dispose();
            }
            using (StreamWriter sw = System.IO.File.AppendText(strPath))
            {
                sw.WriteLine(message + “,Error Message: ” + ex.Message);
            }
        }

        private static ClientContext MixedAuthRequest(string siteUrl, string userName, string pwd, string domain)
        {
            ClientContext returnContext = null;
            ClientContext spClientContext = null;

            int retryCount = 5; // Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings[“retryCount”]);   

            for (int i = 0; i <= retryCount; i++)
            {
                try
                {
                    using (spClientContext = new ClientContext(siteUrl))
                    {

                        spClientContext.ExecutingWebRequest += new EventHandler(Ctx_MixedAuthRequest);
                        spClientContext.AuthenticationMode = ClientAuthenticationMode.Default;

                        spClientContext.Credentials = new NetworkCredential(userName, pwd, domain);
                        returnContext = spClientContext;

                        break;
                    }
                }
                catch (Exception ex)
                {
                    if (i == retryCount)
                    {
                        Console.WriteLine(“Falied Mixed Auth Context: ” + ex.Message);
                        throw;
                    }
                }
            }
            return returnContext;
        }

        private static void Ctx_MixedAuthRequest(object sender, WebRequestEventArgs e)
        {
            //Add the header that tells SharePoint to use Windows authentication.
            e.WebRequestExecutor.RequestHeaders.Add(
            “X-FORMS_BASED_AUTH_ACCEPTED”, “f”);
        }

        public static ClientContext Auth(string siteURL, string username, string password, string domain)
        {
            ClientContext context = new ClientContext(siteURL);
            Web web = context.Web;

            // for network credentials
            NetworkCredential _myCredentials = new NetworkCredential(username, password, domain);
            context.AuthenticationMode = ClientAuthenticationMode.Default;
            context.Credentials = _myCredentials;
            //ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; // .NET 4.5 ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072; // .NET 4.0

            //context.Credentials = new SharePointOnlineCredentials(spoUserName, pwd);
            try
            {
                context.Load(web);
                context.ExecuteQuery();
                Console.WriteLine(“Authentication Succesful for ” + web.Title + ” site”);
                return context;
            }
            catch (Exception e)
            {
                Console.WriteLine(“Authentication failed.”);
                return null;
            }
        }

    }

Posted in nintex webservice, Nintex workflow, SharePoint | Leave a comment

Get All List Items from SharePoint List page wise to handle threshold limit


Below is the common error during development:
The attempted operation is prohibited because it exceeds the list view threshold enforced by the administrator. 
How to handle in client object model?
  • To avoid threshold error, we can use below orderby query.
OrderBy Override=’TRUE’>

  • Using Sorting on the returned list
items = items.OrderBy(item => item.FieldValues[“FileLeafRef”]).ToList();
  • Implementing the search on the items. Sample below which brings matched document string name on the page
items = items.FindAll(f => f.FieldValues[“FileLeafRef”].ToString().ToLower().Contains(“”.ToLower())).ToList();
  •  Complete Method
Posted in client object model, csom, SharePoint, The attempted operation is prohibited because it exceeds the list view threshold enforced by the administrator., threshold | Leave a comment

Check if SharePoint Group Exists Client Object Model

Check if SharePoint Group Exists Client Object Model

Web web = clientContext.Site.RootWeb;
clientContext.ExecuteQuery();
var currentGroups = web.SiteGroups;
clientContext.Load(currentGroups);
clientContext.ExecuteQuery();
bool isGroupExists = false;
if (currentGroups.Count > 0)
{
isGroupExists = currentGroups.OfTypeGroup>().Count(g => g.Title.Equals(“Pass your groupname”, StringComparison.InvariantCultureIgnoreCase)) > 0;

}

Posted in CheckIfSPGroupExists, client object model, SharePoint | Leave a comment

workspace time zone issue

Looks like fix for KB3101521 workspace issue is already out on Feb 9 2016. We should validate and pass this info to the users and desktop team.

You use SharePoint Workspace in a time zone that does not observe daylight savings time (DST). You apply KB3101521 to Microsoft Office 2010. After the update, when you try to open or create a workspace, you receive one of the following errors: 

Technorati Tags:

 

Technorati Tags: ,

 

https://support.microsoft.com/en-us/kb/3114750

Leave a comment

Increasing workflow thresholds / throttle values for SharePoint farm 2013

 

·  Throttle

·  Batch size

·  Timeout

·  Workflow timer interval

stsadm -o getproperty -pn workflow-eventdelivery-throttle

stsadm -o setproperty -pn workflow-eventdelivery-throttle -pv “25”

stsadm -o getproperty -pn workflow-eventdelivery-timeout

stsadm -o setproperty -pn workflow-eventdelivery-timeout -pv “10”

stsadm -o setproperty -pn job-workflow -pv 10 -url <webappurl>

stsadm -o setproperty -pn workflow-eventdelivery-throttle -pv “100”

stsadm -o getproperty -pn workflow-eventdelivery-throttle

Leave a comment

Terminating Error red Occurred, Orphaned, Running Nintex Workflows.

 

$Output=”C:\sites_NintexLogs.csv”;

function Cancel-SPWorkflow(){
PARAM
(
[Parameter(ValueFromPipeline=$true)] [Microsoft.SharePoint.Workflow.SPWorkflow] $SPWorkflow
)
 
BEGIN {
}
 
END {
}
 
PROCESS {
        [Microsoft.SharePoint.Workflow.SPWorkflowManager]::CancelWorkflow($SPworkflow)
    }
 
}
 
function Get-SPWorkflow(){
PARAM
(
[Parameter(ValueFromPipeline=$true)] [Microsoft.SharePoint.SPListItem] $SPListItem
)
 
BEGIN {
}
 
END {
}
 
PROCESS {
        $SPListItem.Workflows
    }
 
}

“WebApplicationName” +”,” + “SiteName” +”,” + “SiteURL” +”,” + “ListURL” +”,”+ “NintexLog”|  Out-File -Encoding Default -FilePath $Output;
$farm = Get-SPWebApplication | select DisplayName
$NintexLog;

    foreach($app in $farm)
    {

      $webapp = Get-SPWebApplication | ? {$_.DisplayName -eq $app.DisplayName}

      
            write-host “Webapplication Title:”$webapp.DisplayName
            Foreach ($SPSite in $Webapp.Sites)
        {
        foreach($SPweb in $SPSite.AllWebs)
            {
            foreach($Subsite in $SPweb)
                {
                     foreach($list in $Subsite.lists)
                    {
                   

                        $NintexLog = $list.Items  | Get-SPWorkflow | where {[DateTime]$_.Modified -lt “04/16/2015 12:00:00 AM”}
 
                        $list.Items  | Get-SPWorkflow| where {[DateTime]$_.Modified -lt “04/16/2015 12:00:00 AM”} | Cancel-SPWorkflow

                        $webapp.DisplayName  + “,” + $Subsite.Title + “,” + $Subsite.URL  + “,” + $list.Title + “,” +$NintexLog | Out-File -Encoding Default -Append -FilePath $Output;
                   
                    }

                }
            }
        }

    }

 

$Output=”C:\sites_NintexLogs.csv”;

function Cancel-SPWorkflow(){
PARAM
(
[Parameter(ValueFromPipeline=$true)] [Microsoft.SharePoint.Workflow.SPWorkflow] $SPWorkflow
)
 
BEGIN {
}
 
END {
}
 
PROCESS {
        [Microsoft.SharePoint.Workflow.SPWorkflowManager]::CancelWorkflow($SPworkflow)
    }
 
}
 
function Get-SPWorkflow(){
PARAM
(
[Parameter(ValueFromPipeline=$true)] [Microsoft.SharePoint.SPListItem] $SPListItem
)
 
BEGIN {
}
 
END {
}
 
PROCESS {
        $SPListItem.Workflows
    }
 
}

“WebApplicationName” +”,” + “SiteName” +”,” + “SiteURL” +”,” + “ListURL” +”,”+ “NintexLog”|  Out-File -Encoding Default -FilePath $Output;
$farm = Get-SPWebApplication | select DisplayName
$NintexLog;

    foreach($app in $farm)
    {

      $webapp = Get-SPWebApplication | ? {$_.DisplayName -eq $app.DisplayName}

      
            write-host “Webapplication Title:”$webapp.DisplayName
            Foreach ($SPSite in $Webapp.Sites)
        {
        foreach($SPweb in $SPSite.AllWebs)
            {
            foreach($Subsite in $SPweb)
                {
                     foreach($list in $Subsite.lists)
                    {
                   

                        $NintexLog = $list.Items  | Get-SPWorkflow | where {[String]$_.StatusText -match [String]”Error”}
                        $list.Items  | Get-SPWorkflow| where {[String]$_.StatusText -match [String]”Error”} | Cancel-SPWorkflow

                        $webapp.DisplayName  + “,” + $Subsite.Title + “,” + $Subsite.URL  + “,” + $list.Title + “,” +$NintexLog | Out-File -Encoding Default -Append -FilePath $Output;
                   
                    }

                }
            }
        }

    }

 

$Output=”C:\sites_NintexLogs.csv”;
“WebApplicationName” +”,” + “SiteName” +”,” + “SiteURL” +”,” + “NintexLog”|  Out-File -Encoding Default -FilePath $Output;
$farm = Get-SPWebApplication | select DisplayName
$NintexLog;

    foreach($app in $farm)
    {

      $webapp = Get-SPWebApplication | ? {$_.DisplayName -eq $app.DisplayName}

      
            write-host “Webapplication Title:”$webapp.DisplayName
            Foreach ($SPSite in $Webapp.Sites)
        {
        foreach($SPweb in $SPSite.AllWebs)
            {
            foreach($Subsite in $SPweb)
                {

            $NintexLog = Nwadmin.exe  -o syncterminatedworkflows -url $Subsite.URL -terminateDeletedItems

                    $webapp.DisplayName  + “,” + $Subsite.Title + “,” + $Subsite.URL  + “,” + $NintexLog | Out-File -Encoding Default -Append -FilePath $Output;

                }
            }
        }

    }

 

$Output=”C:\sites_NintexLogs_180_300.csv”;

 
function Get-SPWorkflow(){
PARAM
(
[Parameter(ValueFromPipeline=$true)] [Microsoft.SharePoint.SPListItem] $SPListItem
)
 
BEGIN {
}
 
END {
}
 
PROCESS {
        $SPListItem.Workflows
    }
 
}

Get_RunningNintexWorkflow180_300_600_1000DaysOld

“WebApplicationName” +”,” + “SiteName” +”,” + “SiteURL” +”,” + “SiteOwner Email” +”,” + “ListURL” +”,” + “180Days” +”,” + “300Days” +”,” + “600Days” +”,” + “1000Days”|  Out-File -Encoding Default -FilePath $Output;
$farm = Get-SPWebApplication | select DisplayName

$180Days;
$300Days;
$600Days;
$1000Days;

    foreach($app in $farm)
    {

      $webapp = Get-SPWebApplication | ? {$_.DisplayName -eq $app.DisplayName}

        if($webapp -notmatch  “mysite”)        
    {
         
            write-host “Webapplication Title:”$webapp.DisplayName
            Foreach ($SPSite in $Webapp.Sites)
        {
        foreach($SPweb in $SPSite.AllWebs)
            {
            foreach($Subsite in $SPweb)
                {
                     foreach($list in $Subsite.lists)
                    {
                   

                        $180Days = $list.Items  | Get-SPWorkflow | where {[DateTime]$_.Modified -lt “05/11/2015 12:00:00 AM”}
                        $300Days = $list.Items  | Get-SPWorkflow | where {[DateTime]$_.Modified -lt “01/24/2015 12:00:00 AM”}
                        $600Days = $list.Items  | Get-SPWorkflow | where {[DateTime]$_.Modified -lt “03/30/2014 12:00:00 AM”}
                        $1000Days = $list.Items  | Get-SPWorkflow | where {[DateTime]$_.Modified -lt “02/23/2013 12:00:00 AM”}
 
                        $webapp.DisplayName  + “,” + $Subsite.Title + “,” + $Subsite.URL  + “,” + $Subsite.RequestAccessEmail + “,” + $list.Title + “,” +$180Days.Count + “,” +$300Days.Count+ “,” +$600Days.Count+ “,” +$1000Days.Count| Out-File -Encoding Default -Append -FilePath $Output;
                   
                    }

                }
            }
        }

      }

      }

 

Leave a comment

Getting All the Orphaned Nintex workflows

 

$Output=”C:\sites_NintexLogs.csv”;
“WebApplicationName” +”,” + “SiteName” +”,” + “SiteURL” +”,” + “NintexLog”|  Out-File -Encoding Default -FilePath $Output;
$farm = Get-SPWebApplication | select DisplayName
$NintexLog;

    foreach($app in $farm)
    {

      $webapp = Get-SPWebApplication | ? {$_.DisplayName -eq $app.DisplayName}

      
            write-host “Webapplication Title:”$webapp.DisplayName
            Foreach ($SPSite in $Webapp.Sites)
        {
        foreach($SPweb in $SPSite.AllWebs)
            {
            foreach($Subsite in $SPweb)
                {

            $NintexLog = Nwadmin.exe  -o syncterminatedworkflows -url $Subsite.URL -showmissingitems 

                    $webapp.DisplayName  + “,” + $Subsite.Title + “,” + $Subsite.URL  + “,” + $NintexLog | Out-File -Encoding Default -Append -FilePath $Output;

                }
            }
        }

    }

Terminating all the Orphaned Nintex workflows.

$Output=”C:\sites_NintexLogs.csv”;
“WebApplicationName” +”,” + “SiteName” +”,” + “SiteURL” +”,” + “NintexLog”|  Out-File -Encoding Default -FilePath $Output;
$farm = Get-SPWebApplication | select DisplayName
$NintexLog;

    foreach($app in $farm)
    {

      $webapp = Get-SPWebApplication | ? {$_.DisplayName -eq $app.DisplayName}

      
            write-host “Webapplication Title:”$webapp.DisplayName
            Foreach ($SPSite in $Webapp.Sites)
        {
        foreach($SPweb in $SPSite.AllWebs)
            {
            foreach($Subsite in $SPweb)
                {

            $NintexLog = Nwadmin.exe  -o syncterminatedworkflows -url $Subsite.URL -terminateDeletedItems

                    $webapp.DisplayName  + “,” + $Subsite.Title + “,” + $Subsite.URL  + “,” + $NintexLog | Out-File -Encoding Default -Append -FilePath $Output;

                }
            }
        }

    }

Leave a comment