JEAZ The bump and grind of daily SysAdmin life

27Jun/140

Remove Workflow Status Columns

Working in SharePoint 2010, I used the Content and Structure Tool to copy list items from a list with workflows to one without

Unfortunately, the workflow status column was also created in the destination list.
Clearly, this wasn't a useful column and I didn't want it in my fields.

How do you remove a workflow status column?
It's pretty easy with some PowerShell

PS C:\> $web = Get-SPWeb https://site.domain.com/web
PS C:\> $list = $web.Lists["List Name"]
PS C:\> $field = $list.Fields["Workflow Status Column Name"]
PS C:\> $field.Hidden
False
PS C:\> $field.ReadOnlyField
True
PS C:\> $field.ReadOnlyField = $false
PS C:\> $field.Update()

Once the field is no longer a ReadOnlyField you can delete it like any other column
You can also throw in $field.Delete() at the end

14Feb/130

Set-SCAdvisorActionAccount : The action parameter should be provided if computers are specified.

When configuring the SharePoint action account for System Center Advisor I ran into a problem.

http://onlinehelp.microsoft.com/en-us/advisor/hh923060.aspx

Run the Set-SCAdvisorActionAccount cmdlet to set the credentials. For example, if the agent computer name is Com1, run the following:

Set-SCAdvisorActionAccount -ActionAccountName Microsoft.SharePoint.Foundation.2010.AdminAccount -Credential $credential -AllowedComputer Com1

Well, that gives an error:

Set-SCAdvisorActionAccount : The action parameter should be provided if computers are specified.

Here is what it should look like:
Set-SCAdvisorActionAccount -ActionAccountName Microsoft.SharePoint.Foundation.2010.AdminAccount -Credential $credential -AllowedComputer Com1 -Action Set

Action parameter is explained on this other page:
http://onlinehelp.microsoft.com/en-us/advisor/hh965410.aspx

Parameters

-Action

Specifies an action. You have the following choices:

Set: Assign the computers in the -AllowedComputer parameter to the action account.

Add: Add the computers in the -AllowedComputer parameter to the action account.

Remove: Remove the computers listed in the -AllowedComputer parameter from the action account and delete the credentials stored in the computer*.

Clear: Remove all computers from the action account and delete the credential stored in all computers assigned to the action account*.

* After you remove a computer from the credential distribution from the gateway, the agent needs to wait for the next polling cycle to update the credentials. The agent compares the new and old credential sets and removes any credentials that are present in the old credential set but absent in the new set.

Here are the Cmdlets for System Center Advisor:
http://onlinehelp.microsoft.com/en-us/advisor/hh781477.aspx

23Jan/113

Set all user’s home directories with PowerShell

Get-ADUser -SearchBase "OU=Users,DC=test,DC=ad" | % { Set-ADUser $_ -HomeDrive "H:" -HomeDirectory ('\\fileserver\home\' + $_.SamAccountName) }

Let me explain how this works briefly:

Get-ADUser = Get users from AD
-SearchBase "ldap" = Root of the tree in AD to get users from
| = Pipe, provide input of query to...
% = ForEach item piped from query
Set-ADUser = Write changes to AD
$_ = item piped from query
-HomeDrive "X:" = Sets home drive letter, requires colon and quotes!!
-HomeDirectory = Home drive path
$_.SamAccountName = item piped from query's property "SamAccountName" aka username.

We chose to use the username for the folders in the home directory storage, you don't necessarily have to.

Notice the (paranthesis) which tell Powershell to take my stringĀ \\fileserver\home\ and variable $_.SamAccountName and mush them together, passing both as the final string to -HomeDirectory

Thanks #powershell on Freenode and MS documentation examples

Technet on Set-ADUser:

http://technet.microsoft.com/en-us/library/ee617215.aspx

Tagged as: 3 Comments