SharePoint 2013 Prerequisite Installer Failing – Unable to Install IIS

Literally been banging my head against the table, wall and floor over this one. I kept getting the error you can see below when trying to run the SharePoint 2013 prerequisite installer:

After a LOT of research and trying a bunch of different “solutions”, all completely failing to fix the issue, I look into the error log file. I know, right. What a nerd!? There is referenced trying to use a “ServerManagerCMD.exe” in the system32 directory. I looked and could only find a “ServerManager.exe”.

“Well shit”, I thought to myself. Microsoft is bloody amazing and SharePoint is the cherry on top of the cake.

So to fix this, I copied the “ServerManager.exe” file and renamed it to be “ServerManagerCMD.exe”:

And surely enough, after closing the installer and retrying, everything went swimmingly!

Enjoy!

SharePoint Group Membership WinForm

This is a little WinForm I created that would output the group membership for a domain user or FBA (Forms-Based Authentication) user on SharePoint.

This is what the form looks like, it gives the option for a domain or FBA user and also checked if the user exists before trying to get the relevant information:

The form first checks if CredSSP is configured on your machine to delegate your credentials to the SharePoint server. The form then loads, waits for your input, validates your input and finally collects the group information for your input.

And finally, this is the code for the Winform. I’ve removed some details as they need to be filled in by you. Enjoy!

#CHECKING CREDSSP SETTINGS
if ((Get-Item  WSMan:\localhost\Client\Auth\CredSSP).value -eq $false){
    #CREDSSP NOT CONFIGURED, EXITING
    Write-Host @"
    
CredSSP is not configured!

Please open an elavated PowerShell prompt and run:

Enable-WSManCredSSP -Role client -DelegateComputer sandsharepointf

"@
    Exit
}else{}

#LOADING ASSEMBLIES
Add-Type -AssemblyName System.Windows.Forms
[System.Windows.Forms.Application]::EnableVisualStyles()

#ICON FOR THE FORM
[string]$icon64=@"
#base64data
"@

#CONVERTING BASE 64 ICON INTO GRAPHIC
$iconstream = [System.IO.MemoryStream][System.Convert]::FromBase64String($icon64)
$iconbmp = [System.Drawing.Bitmap][System.Drawing.Image]::FromStream($iconstream)
$iconhandle = $iconbmp.GetHicon()
$icon = [System.Drawing.Icon]::FromHandle($iconhandle)

#FORM
$SharePoint_Membership_Form                 = New-Object system.Windows.Forms.Form
$SharePoint_Membership_Form.ClientSize      = '400,278'
$SharePoint_Membership_Form.text            = "SharePoint Membership"
$SharePoint_Membership_Form.TopMost         = $false
$SharePoint_Membership_Form.StartPosition   = "centerscreen"
$SharePoint_Membership_Form.Icon            = $icon
$SharePoint_Membership_Form.FormBorderStyle = "Fixed3D"

#USERNAME LABEL
$Username_Label                  = New-Object system.Windows.Forms.Label
$Username_Label.text             = "Enter a username:"
$Username_Label.AutoSize         = $true
$Username_Label.width            = 25
$Username_Label.height           = 10
$Username_Label.location         = New-Object System.Drawing.Point(146,12)

#USERNAME TEXTBOX
$Username_Textbox                = New-Object system.Windows.Forms.TextBox
$Username_Textbox.multiline      = $false
$Username_Textbox.width          = 175
$Username_Textbox.height         = 20
$Username_Textbox.location       = New-Object System.Drawing.Point(115,33)

#VARIABLE FOR KEYDOWN
$Username_Textbox_keydown = {}

#KEYDOWN ASSIGNED
$Username_Textbox_keydown = [System.Windows.Forms.KeyEventHandler]{
    if ($_.keycode -eq 'Enter'){
        $Search_Button.PerformClick()
    }
}

#REGISTER KEYDOWN HANDLER TO USERNAME TEXTBOX
$Username_Textbox.add_keydown($Username_Textbox_keydown)

#DOMAIN RADIO BUTTON
$Domain_User_RB                  = New-Object system.Windows.Forms.RadioButton
$Domain_User_RB.text             = "Domain User"
$Domain_User_RB.AutoSize         = $true
$Domain_User_RB.width            = 104
$Domain_User_RB.height           = 20
$Domain_User_RB.location         = New-Object System.Drawing.Point(120,64)
$Domain_User_RB.Checked          = $true

#SHAREPOINT FBA USER RADIO BUTTON
$FBA_User_RB                     = New-Object system.Windows.Forms.RadioButton
$FBA_User_RB.text                = "FBA User"
$FBA_User_RB.AutoSize            = $true
$FBA_User_RB.width               = 104
$FBA_User_RB.height              = 20
$FBA_User_RB.location            = New-Object System.Drawing.Point(215,64)

#SEARCH BUTTON
$Search_Button                  = New-Object system.Windows.Forms.Button
$Search_Button.text             = "Search"
$Search_Button.width            = 60
$Search_Button.height           = 30
$Search_Button.location         = New-Object System.Drawing.Point(171,89)

#SEPERATOR LINE
$Seperator_Label                 = New-Object system.Windows.Forms.Label
$Seperator_Label.text            = ""
$Seperator_Label.AutoSize        = $false
$Seperator_Label.BorderStyle     = "Fixed3D"
$Seperator_Label.width           = 390
$Seperator_Label.height          = 2
$Seperator_Label.location        = New-Object System.Drawing.Point(5,124)

#OUTPUT TEXTBOX
$Output_Textbox                 = New-Object System.Windows.Forms.TextBox
$Output_Textbox.Multiline       = $true
$Output_Textbox.Width           = 390
$Output_Textbox.Height          = 142
$Output_Textbox.Location        = New-Object System.Drawing.Point(5,131)
$Output_Textbox.ReadOnly        = $true
$Output_Textbox.ScrollBars      = "vertical"

#ADDING CONTROLS TO FORM
$SharePoint_Membership_Form.controls.AddRange(@($Domain_User_RB,$FBA_User_RB,$Seperator_Label,$Username_Label,$Username_Textbox,$Search_Button,$Output_Textbox))

$Search_Button.add_click({

    $Output_Textbox.Text = ""

    #DATE FOR OUTPUT
    $date = Get-Date    
    $username_value = $Username_Textbox.Text
    $Username_Prefix = $null
    $location = #base location

    #SETTING SEARCH VALUES BACK TO FALSE
    $Search_On_AD_User = $false
    $Search_On_FBA_User = $false

    #CHECKING IF USERNAME TEXTBOX IS EMPTY
    if ($Username_Textbox.Text.Length -le 0){
        #IF EMPTY, VARIABLE IS FALSE
        $Output_Textbox.AppendText("$date - $Username cannot be empty! `n")
        $Username_Not_Empty = $false
    }else{
        $Username_Not_Empty = $true
        $Output_Textbox.Text = ""
    }

    #RUNS IF DOMAIN USER RADIO BUTTON IS CHECKED
    if ($Domain_User_RB.Checked -and $Username_Not_Empty){
        try{
            $Output_Textbox.AppendText("$date - Searching for $username_value `n")
            Get-ADUser -Identity $username_value

            $Output_Textbox.AppendText("$date - Found user! `n")

            $Search_On_AD_User = $true
            $Search_On_FBA_User = $false

            $Username_Found = $true

        }catch{
            $Output_Textbox.AppendText("$date - Cannot find domain user `n")
            $Username_Found = $false
        }
    }

    #RUNS IF FBA USER RADIO BUTTON IS CHECKED
    if ($FBA_User_RB.Checked -and $Username_Not_Empty){
        
        $SPAdmin = "sharepoint_admin_user"
        $credential = New-Object System.Management.Automation.PSCredential $SPAdmin,  (Get-Content "$location\sharepoint_admin_user_encrypted_password.txt" | ConvertTo-SecureString )

        $sb = {
            $username = $args[0]
            Add-PSSnapin microsoft.sharepoint.PowerShell
            $user = Get-SPUser -Limit All -Web http://SHAREPOINTSERVER | 
                Where-Object {$_.loginname -like "i:0#.f|fbamembershipprovider|$username"}

            return $user
        }

        $Output_Textbox.AppendText("$date - Trying to find $username_value... `n")

        $invokeoutputfbasearch = Invoke-Command -ScriptBlock $sb -ComputerName SHAREPOINTSERVER -Authentication Credssp -Credential $credential -ArgumentList $username_value

        if ($invokeoutputfbasearch){
            #FOUND USER
            $Username_Found = $true
            $Search_On_FBA_User = $true
            $Search_On_AD_User = $false
            $Output_Textbox.AppendText("$date - Found FBA user!`n")
        }else{
            #NOT FOUND USER
            $Username_Found = $false
            $Output_Textbox.AppendText("$date - Cannot find FBA user `n")
        }
    }

    #ONLY RUNS IF BELOW CONDITIONS ARE MET
    if ($Username_Found -and $Username_Not_Empty){
        #ASSIGNING THE RIGHT USERNAME FORMAT
        if ($Search_On_AD_User){
            $Username_Prefix = "*|DOMAIN_NAME\"
        }else{
            $Username_Prefix = "i:0#.f|fbamembershipprovider|"
        }

        $SPAdmin = "sharepoint_admin_user"
        $credential = New-Object System.Management.Automation.PSCredential $SPAdmin,  (Get-Content "$location\sharepoint_admin_user_encrypted_password.txt" | ConvertTo-SecureString )

        $sb = { 
            $groups = $null
            $prefix = $args[0]
            $username = $args[1]
            Add-PSSnapin Microsoft.SharePoint.PowerShell
            $user = get-SPUser -limit all -web http://SHAREPOINTSERVER | 
                Where-Object { $_.loginname -like "$prefix$username" }
                $SPGroups = get-spsite -limit all | 
                    Select-Object -ExpandProperty rootweb | 
                    Select-Object -ExpandProperty siteusers | 
                    Where-Object { $user.userlogin -eq $_.loginname } | 
                    Select-Object -ExpandProperty groups | 
                    Select-Object -ExpandProperty name
            foreach ($i in $SPGroups){
                $groups = $groups + "     - $i `r`n"
            }
        return $groups
        }

        $Output_Textbox.AppendText("$date - Collecting group info on $username_value... `n")

        $InvokeOutputfinal = Invoke-Command -ScriptBlock $sb -ComputerName SHAREPOINTSERVER -Authentication Credssp -Credential $credential -ArgumentList $Username_Prefix,$username_value

        $Output_Textbox.AppendText("`n")
        $Output_Textbox.AppendText("$InvokeOutputfinal")

    }else{#THIS SERVES ONLY AS A TRAP TO STOP ANYTHING RUNNING
    }
})

#DISPLAYING FORM
[void]$SharePoint_Membership_Form.ShowDialog()

SharePoint 2013 Prerequisite Installer Failing – No Internet

I recently tried installing SharePoint 2013 and came across a weird issue which stopped the prerequisite installer from running to completion. It complained that it didn’t have access to the internet which was really odd.

I found a workaround for this which I found here was to change some of the settings in Internet Explorer. What I did can be followed below:

  1. Open IE and go to “www.microsoft.com” and uncheck the prompt which will continue to display pop-ups
  2. Go to the gear icon -> Internet Options -> Security and open the trusted sites
  3. now add “http://*microsoft.com” to the trusted site list
  4. save and close IE

Now you should be able to run the installer without an issue. Enjoy!

SharePoint URL Changing

There are two main ways that I change the URL of a list or library on a SharePoint site. First off I’d like to explain why I often have to do these tricks. Whenever you create a new SharePoint site from a template, even after you change the names of all the lists and libraries in a web page, the URL will still reference what ever the template lists were called.

Option 1 – SharePoint Designer

To change the URL in SharePoint designer, open your site using the URL “http://HOSTNAME/sites/SITENAME” and this should give you list of items in the left hand column resembling the screenshot below:

SharePoint Designer Column

You should see that the bottom option says “All Files“, double click this and go into “Lists“. This will show all of the lists on your site and you should see that they are all using the old name which is the cause of the incorrect URLs. Simply rename these lists to what ever you need and the URL will change.

 

Option 2 – File Explorer

If you don’t see the “All Files” section in SharePoint designer then this method can be used instead. Open a file explorer and navigate to your site. You can see how I have done this below:

File Explorer

Now go into “Lists” and you should be able to see the incorrectly named lists. Simply rename these lists and the URL will change.

 

I’m not sure why the “All Files” section in SharePoint designer doesn’t show so If anyone can shed some light on that I would be appreciated. Enjoy!

Mailto in SharePoint String Builder

Bit of a weird, one off sort of thing. I was creating a workflow in SharePoint which would send an email. On this email would be an “Approve” and “Decline” button. The decline button was easy enough to do but the approve button turned out to be a complete pain in the back side.

First of all, I would like to tell you to not use mailto whenever you can. There are better programs out there. Trust me. If anyone knows any really good ones that they standby please feel free to leave a comment.

The mailto syntax is basically this:

mailto:RECIPIENT?cc=CCRECIPIENT&subject=SUBJECT TEXT&body=BODY TEXT

This looks simple enough but once you want to start doing some more complicated features/formatting that would otherwise be quite simple in HTML, become near impossible here. Especially with it being in a SharePoint string builder box.

What I wanted was for there to be three lines of text, two in which got information from the SharePoint form to fill in the information and one for adding text. By the way if you didn’t know, to add a new line you can use “%0d0d“.

That’s: percent sign – zero – delta – zero – delta

This is the final code that I ended up with:

mailto:RECIPIENT@EMAIL.COM?cc=[%Current Item:Created By%]&subject=Approval Authorisation for [%Current Item:Created By%]&body=The remote access request for [%Current Item:Created By%] has been approved by [%Current item:Manager's Name%]%0d%0dThe reason for approval is - [%Current Item:Reason for approval%]%0d%0dPlease specify any limitations below:

Here is a picture just in case you want to see it and below that what the actual email looks like:

String Builder

Email

I would like to add that you will have to change the “Add or Change Lookup” so that it finds the “Display Name”, otherwise the users will show as the default SharePoint format which isn’t as good looking. You can see this below:

Display Name

Hope you enjoyed and found this useful. I may to an entire blog trying to outline the possibilities of using the SharePoint string builder and “Define E-Mail Message” features. Suppose you’ll have to wait and see.