Thursday, 10 December 2015

Using fiddler to auto respond

Scenario:

We have got something working in Live but not in test environment after the release of new version, we were using the knockout framework on one of the SharePoint portal page. I had to check if the knockout different version is causing issue with our script. In order to quickly see if the same version which we got on live would work against Test environment. I did following

Using Fiddler:

1. Download Fiddler
2. Make a request to the portal Page
3. In fiddler session listing find the script file you like to replace
4. Right click on file and select decode Selected Session
5. On the AutoResponder Tab
  Enable the 'Enable Rules' checkbox
  Enable  the 'Unmatched Requests Pass through' check box

6.  Drag and drop the file to AutoResponder Rule Area
7.  At a bottom under Rule Editor section
Select the second drop down list and select the option of select a file
8. Select the file which you like fiddler to use to mimic response from server by using local file
9. Click Save
10. Refresh page

Monday, 26 October 2015

Invalid Action

When trying to browse for CRM org, I started to get following Error


Invalid Action
The selected action was not valid.


When looking into event viewer got following information.


Current key (KeyType : CrmWRPCTokenKey) is expired. This can indicate that a key is not being regenerated correctly. Current Key : CrmKey(Id:4e1d5f40-4d60-e511-a481-00155dc1050c, ScaleGroupId:00000000-0000-0000-0000-000000000000, KeyType:CrmWRPCTokenKey, Expired:True, ValidOn:09/21/2015 10:41:04, ExpiresOn:10/24/2015 10:41:04, CreatedOn:09/21/2015 10:41:04, CreatedBy:<domain>\<domain user name>.




Resolution:
Start the async service (this could be stopped for many reasons, running out of space/performace and developer thought to stop, service was configured to run under user account and the useraccount either expired or disabled and now async service no longer running). Once async service started restart IIS after 5 minutes, so that new generated keys can be used.



Monday, 12 October 2015

windows shortcut commands

Windows -> Run

1. inetcpl.cpl : opens internet options

2. iexplore.exe -extoff : opens internet explorer with addons as disabled

3. inetmgr : opens IIS manager

Monday, 21 September 2015

Enable-WSManCredSSP : Root element is missing.

 Enable-WSManCredSSP -Role Server

Enable-WSManCredSSP -Role client -DelegateComputer *.<<FQDN e.g kuk.solutions.com>>

Error:
Enable-WSManCredSSP : Root element is missing.




At line:1 char:1

+ Enable-WSManCredSSP -Role client -DelegateComputer *.mydomain.com

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ CategoryInfo : NotSpecified: (:) [Enable-WSManCredSSP], XmlException

+ FullyQualifiedErrorId : System.Xml.XmlException,Microsoft.WSMan.Management.EnableWSManCredSSPCommand
 
 


Solution applied was to run the script provided in the link below to directly update values.

http://stackoverflow.com/questions/18113651/powershell-remoting-policy-does-not-allow-the-delegation-of-user-credentials


 

Friday, 18 September 2015

get crm service users and app pool identitiy and add them to sharepoint

#$SPSiteURL = 'http://lbh.ntlm/sites/rnbtest'
#$GroupName = 'CRM Docs Members '

[CmdletBinding()]
param ([Parameter(Mandatory=$true)] $SPSiteURL,[Parameter(Mandatory=$true)] $GroupName)
$ErrorActionPreference = "Stop"
 

$CRMAPPUsers = Get-WmiObject win32_service | Where-Object{ ($_.Name -like "MSCRMUnzipService") -or ($_.Name -like "MSCRMSandboxService") -or ($_.Name -like 'MSCRMAsyncService$maintenance') -or ($_.Name -like "MSCRMAsyncService") } |%{$_.StartName}|Get-Unique

$CRMAppUser = Get-WmiObject -Class IISApplicationPoolSetting -namespace "root\microsoftiisv2" | Where-Object {$_.Name -like 'W3SVC/APPPOOLS/CRMAppPool'}|%{$_.WAMUserName}
$Users = $CRMAsyncUser , $CRMAPPUsers
$Users = $Users|Get-Unique
if ($ver.Version.Major -gt 1) {$host.Runspace.ThreadOptions = "ReuseThread"}
if ((Get-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue) -eq $null) {
Add-PSSnapin "Microsoft.SharePoint.PowerShell"
}
[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")

$GroupName ='RNBTest Members'
$web = Get-SPWeb -Identity $SPSiteURL
foreach ($User in $Users) {
$User
$web.EnsureUser($User)
$SPUser = get-spuser -web $sPSiteURL|where-object{$_.userlogin -like "*$User*"} |%{$_.Userlogin}

Set-SPUser -UserAlias $SPUser -Web $SPSiteURL -Group $GroupName
#stsadm -o adduser -url $SPSiteURL -userlogin $User -useremail "email@dummy.com" -group $group -username 'dummyusername'
}