PowerShell Recursive List Folder Permissions Out to Gridview

PS C:\Windows\system32> get-childitem c:\windows\microsoft.net\framework64 -recurse | where{$_.psiscontainer} | get-acl | Out-Gridview

Advertisements

SharePoint Server 2010 Configure People Picker

When the People Picker control is used, a user’s name is resolved when the Check Name icon is clicked or a list of users is displayed when the Browse icon is clicked.

If the Web application is using Windows authentication and the site user directory path is not set, the People Picker control searches the entire Active Directory to resolve users’ names or find users, instead of searching only users within a particular organizational unit (OU). The setsiteuseraccountdirectorypath operation allows the user’s directory path to be set to a specific OU in the same domain. After the directory path is set to a site collection, the People Picker control will only search under that particular OU.

If a site collection is new and an administrator uses the setsiteuseraccountdirectorypath operation to specify a target OU, only users under the specified path can be added to the site collection and no one else can be added to the site collection.

If users have already been added to a site collection and the setsiteuseraccountdirectorypath operation is run, only users under the specified path will be able to be added going forward.

To set a list of users to a specific OU (for example, Sales) in the Contoso Corp domain, use the following syntax:

stsadm -o setsiteuseraccountdirectorypath -path “CN=Sales,DC=ContosoCorp,DC=local” –url http://server_name

http://technet.microsoft.com/en-us/library/cc263328(office.12).aspx

http://technet.microsoft.com/en-us/library/gg602075(v=office.14).aspx#section5

 

How to Copy Files from a Server Share to a SharePoint 2010 Library – ASP.Net C# and Command Line

SharePoint Libraries you can “Open with Windows Explorer” I spent some time trying to figure out how to automate file management that I could do using drag and drop. Trouble was, to use the SharePoint libraries you have to develop and run your application on a SharePoint server, which I didn’t want to do. After dorking around on the command line I found that you could assign a drive letter to the SharePoint library via “net use”.

Command Line:

net use r: /delete
net use s: /delete
net use r: \\Server\Share
net use s: https://SharePointServer/Library
del s:. /F/Q
copy r:. s:
net use s: /delete
net use r: /delete

That share shows up in Windows Explorer as a drive mapping that looks like this:

MyLibrary (\\SharePointServer@SSL\DavWWWRoot\)

Well, heck! If that’s the case then the following aught to work – and does!

ASP.Net C#:

string mysharepointlibrary = @"\\SharePointServer@SSL\DavWWWRoot\MyLibrary\";
Array.ForEach(Directory.GetFiles(mysharepointlibrary), File.Delete);
DirectoryInfo dir = new DirectoryInfo(MapPath("~/uploadfolder"));
files = dir.GetFiles();
foreach (FileInfo file in files)
{
  File.Copy(file.FullName, Path.Combine(mysharepointlibrary , file.Name), true);
}

More information:

http://www.iis.net/learn/publish/using-webdav/using-the-webdav-redirector

WebClient Service uses the Local Service account by default.

Recovering from a corrupted SharePoint 2010 Installation that would not create a Search Service Application

After a perfect storm of urgent and ill implemented security measures during a series of updates to SharePoint Server 2010 we were left with a corrupted production SharePoint 2010 installation. The symptoms were that some Web Application databases reported that some components were still updating and we could not create a search service application. These are the steps we went through to repair the installation.

Login as service account used for sptimerv4.
Make sure service account is dbo for all sp dbs plus the master.
Make sure service account is in administrators group, and all iis created groups.
Rerun sharepoint products configuration wizard from start.

psconfig.exe -cmd upgrade -inplace b2b -wait -force

Delete everything in C:\ProgramData\Microsoft\SharePoint\Config\ EXCEPT the cache.ini
Edit cache.ini change number to 1

Stop sptimerv4

stsadm -o setproperty -pn command-line-upgrade-running -pv No

Start sptimerv4

psconfig.exe -cmd upgrade -inplace b2b -wait -force

Rerun sharepoint products configuration wizard as admin from start.
Check version of C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\ISAPI\*.dll

psconfig -cmd installfeatures
psconfig -cmd secureresources
psconfig -cmd services -install
psconfig -cmd upgrade -inplace b2b -wait -force
iisreset /noforce
Upgrade-SPContentDatabase wss_content_sitecollectiondb
Upgrade-SPContentDatabase wss_content_othersitecollectiondb

Deleted unupgradeable datatases:
wss_content_sitecollectiondb
wss_content_othersitecollectiondb

Tell SharePoint that the databases are gone

Get-SPDatabase | where {$_.exists -eq $false}
Get-SPDatabase | where {$_.exists -eq $false} | foreach {$_.delete()}

Rerun sharepoint products configuration wizard as admin from start.

Go to add or remove programs, right click on sharepoint 2010 server and select repair.

Run the SharePoint 2010 configuration wizard, this time remove SharePoint server from farm then add sharepoint server back to the farm.

Run the SharePoint 2010 configuration wizard, this time remove SharePoint server from farm then create new SharePoint farm.

After we created a new SharePoint farm, all of the errors went away and were are again able to create search service applications. It appears to me that the corruption happened in the SharePoint_Config and the Web Application / Root Site Collection database.

In CA, Recover Data from an Unattached Content Database, chose the wss_content_sitecollectiondb, and exported site.

import-spweb -identity https://SharePointServer -path c:\temp\recoverexport.cmp

Command Line to Allow a Smart Card to be Removed without Locking the Computer.

This command line allows me to log into and work on several machines by preventing them from locking after the smart card is removed. However, I have to re-insert the smart card temporarily when I access resources that require further authentication.

c:\windows\system32\cmd.exe /k %windir%\system32\reg.exe ADD "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v scremoveoption /t REG_DWORD /d 0 /f