Skip to content

Archiving home folders

The following code sample archives a user’s home directory to a ZIP file.

[Reflection.Assembly]::LoadWithPartialName("Softerra.Adaxes.Adsi")

$userDN = "CN=John Smith,CN=Users,DC=domain,DC=com"
$archivePath = "\\SERVER\share\JSmith.zip"
$compressionLevel = 1

# Connect to the Adaxes service
$admNS = New-Object "Softerra.Adaxes.Adsi.AdmNamespace"
$admService = $admNS.GetServiceDirectly("localhost")

# Bind to the user
$user = $admService.OpenObject("Adaxes://$userDN", $NULL, $NULL, 0)

# Archive the user's home folder
$user.ArchiveHomeDirectory($archivePath, $compressionLevel)

See also