![]() |
VOOZH | about |
dotnet add package DSInternals.SAM --version 7.0.0
NuGet\Install-Package DSInternals.SAM -Version 7.0.0
<PackageReference Include="DSInternals.SAM" Version="7.0.0" />
<PackageVersion Include="DSInternals.SAM" Version="7.0.0" />Directory.Packages.props
<PackageReference Include="DSInternals.SAM" />Project file
paket add DSInternals.SAM --version 7.0.0
#r "nuget: DSInternals.SAM, 7.0.0"
#:package DSInternals.SAM@7.0.0
#addin nuget:?package=DSInternals.SAM&version=7.0.0Install as a Cake Addin
#tool nuget:?package=DSInternals.SAM&version=7.0.0Install as a Cake Tool
The DSInternals.SAM package implements clients for the Security Account Manager Remote Protocol (MS-SAMR) and Local Security Authority Remote Protocol (MS-LSAD/LSARPC). It enables remote manipulation of user accounts and LSA policies on Windows systems.
using DSInternals.SAM;
string serverName = "dc01.contoso.com";
// Connect to the SAM server
using var samServer = new SamServer(serverName);
// List available domains
string[] domains = samServer.EnumerateDomains();
foreach (string domain in domains)
{
Console.WriteLine($"Domain: {domain}");
}
using DSInternals.SAM;
string serverName = "dc01.contoso.com";
string domainName = "CONTOSO";
string userName = "testuser";
// NT hash to set (32 hex characters = 16 bytes)
byte[] ntHash = Convert.FromHexString("A4F49C406510BDCAB6824EE7C30FD852");
using var samServer = new SamServer(serverName);
using var domain = samServer.OpenDomain(domainName);
using var user = domain.OpenUser(userName);
// Set the NT hash directly
user.SetPasswordHash(ntHash);
Console.WriteLine($"Password hash set successfully for {userName}");
using DSInternals.SAM;
using System.Net;
string serverName = "dc01.contoso.com";
var credential = new NetworkCredential(
userName: "admin",
password: "P@ssw0rd",
domain: "CONTOSO"
);
using var samServer = new SamServer(serverName, SamServerAccessMask.MaximumAllowed, credential);
// Now perform SAM operations...
using DSInternals.SAM;
string serverName = "dc01.contoso.com";
// Get the DPAPI backup key via LSARPC
var backupKey = LsaPolicy.GetDPAPIBackupKey(serverName);
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0-windows7.0 net8.0-windows7.0 is compatible. net9.0-windows net9.0-windows was computed. net9.0-windows7.0 net9.0-windows7.0 is compatible. net10.0-windows net10.0-windows was computed. |
| .NET Framework | net48 net48 is compatible. net481 net481 was computed. |
This package is not used by any NuGet packages.
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 7.0.0 | 235 | 5/28/2026 |
| 6.5.0 | 141 | 5/16/2026 |
| 6.4.0 | 966 | 3/28/2026 |
| 6.3.0 | 382 | 2/8/2026 |
| 6.1.0 | 1,724 | 8/17/2025 |
| 6.0.0 | 246 | 8/14/2025 |
| 5.3.0 | 373 | 4/11/2025 |
| 5.2.0 | 354 | 4/9/2025 |
| 5.0.0 | 284 | 3/3/2025 |
| 4.14.0 | 836 | 4/13/2024 |
| 4.13.0 | 442 | 12/20/2023 |
| 4.12.0 | 286 | 10/6/2023 |
| 4.8.0 | 2,242 | 12/6/2022 |
| 4.5.0 | 2,364 | 10/13/2021 |
| 4.3.0 | 1,835 | 4/2/2020 |
| 4.2.0 | 806 | 3/18/2020 |
| 4.0.0 | 836 | 12/4/2019 |
| 3.2.0 | 1,082 | 1/3/2019 |
| 3.1.0 | 1,091 | 12/29/2018 |
| 3.0.0 | 1,095 | 9/29/2018 |
- Updated assembly dependencies.