Export site users

$site = Get-SPSite http://len-sharetest
$groups = $site.RootWeb.sitegroups
foreach ($grp in $groups) {“Group: ” + $grp.name; foreach ($user in $grp.users) {” User: ” + $user.name; ” User: ” + $user.Email; ” User: ” + $user.UserLogin; “`n”} }
$site.Dispose()

$site = Get-SPSite http://len-sharetest
$groups = $site.RootWeb.sitegroups

foreach ($grp in $groups) {
$resUsers = @{

“Group” = $grp.name
}

foreach ($user in $grp.users) {

$resusers = @{
“UserName:” = $user.name
“UserEmail:” = $user.Email
“UserLogin:” = $user.UserLogin;
}
}
}

 

New-Object PSObject -Property $resUsers

Export site users

Move SQL database

–to move user database
USE master;
GO
— Return the logical file name.
SELECT name, physical_name AS CurrentLocation, state_desc
FROM sys.master_files
WHERE database_id = DB_ID(N’AdventureWorks2012′)
AND type_desc = N’LOG’;
GO
ALTER DATABASE AdventureWorks2012 SET OFFLINE;
GO
— Physically move the file to a new location.
— In the following statement, modify the path specified in FILENAME to
— the new location of the file on your server.
ALTER DATABASE AdventureWorks2012
MODIFY FILE ( NAME = AdventureWorks2012_Log,
FILENAME = ‘C:\NewLoc\AdventureWorks2012_Log.ldf’);
GO
ALTER DATABASE AdventureWorks2012 SET ONLINE;
GO
–Verify the new location.
SELECT name, physical_name AS CurrentLocation, state_desc
FROM sys.master_files
WHERE database_id = DB_ID(N’AdventureWorks2012′)
AND type_desc = N’LOG’;

Move SQL database

post

The SPSite class represents a collection of sites contained on a virtual server, which includes the top-level (root) site and all its subsites. Each SPSite object can be found within the Sites property of an SPWebApplication class.

The SPWeb class represents an instance of a single website. It is often confusing to developers because the root web of a site collection (which is created when a site collection is created) is an instance of the SPWeb class.

post