I am using the following code/function to add groups to a site (SP-2010):
function Create-SPGroupInWeb
{
param ($url, $groupName, $permissionLevel, $description)
try{
$web = Get-SPWeb -Identity $url
if($web -ne $null){
if ($web.SiteGroups[$groupName] -ne $null)
{
write-Host -f red "Group $groupName already exists!"
}
else
{
$web.SiteGroups.Add($groupName, $web.Site.Owner, $web.Site.Owner, $description)
$group = $web.SiteGroups[$groupName]
$roleAssignment = new-object Microsoft.SharePoint.SPRoleAssignment($group)
$roleDefinition = $web.Site.RootWeb.RoleDefinitions[$permissionLevel]
$roleAssignment.RoleDefinitionBindings.Add($roleDefinition)
$web.RoleAssignments.Add($roleAssignment)
$web.Update()
write-Host "Group $groupName created successfully"
}
$web.Dispose()
}
}
catch [System.Exception]
{
write-host -f red $_.Exception.ToString()
}
}
Create-SPGroupInWeb -url "http://my-webApp:port/" -groupName "New Group" -permissionLevel "Read" -description "My New Group Description - <STRONG><U>Branch Manager</U> <FONT
color=#ff0000>ONLY</FONT><FONT color=#000000>!!</FONT></STRONG>"Taken From: Create Site Permission Groups and Add Users for SharePoint - Powershell
This all works 100%
The problem is, is that the "Description" gets added as plain text.
After visiting numerous sites and blogs with tons of methods, nothing has worked!
Question: How do I get it to accept/compile/convert to HTML View?
The Process:
I have an Excel document with a couple hundred Users, Branch Managers, H/O Users, RM's, also various Chains and the Branches under them, etc... which end up in the thousands.
So I take the Excel document provided by Business and use it as is with a few added Sheets with scripts and formulas to pull the required details to "compile" my script as used in the last command in the code above.
I then copy all the rows with the compiled code / "Command" and run it in my PS Script. As mentioned above this works!
It's only the HTML part that I am struggling with.
NB: I'm not new to scripting, but PowerShell and SharePoint is very different to what I'm used to, so please be specific and detailed with your help. :)
TIA,Neil