Home
- Details
- Written by: po3dno
- Category: MSSQL
- Hits: 751
use [DBNAME]
EXEC sp_rename 'v8users', 'v8users_old'
GO
UPDATE Params
SET FileName = 'users.usr_old'
WHERE FileName = 'users.usr'
GO
use [DBNAME]
DROP TABLE v8users
GO
EXEC sp_rename 'v8users_old', 'v8users'
GO
UPDATE Params
SET FileName = 'users.usr'
WHERE FileName = 'users.usr_old'
GO
- Details
- Written by: po3dno
- Category: Power Shell
- Hits: 859
# получить список mac
[System.Collections.ArrayList]$d = (Get-DhcpServerv4Policy -ScopeId 172.16.36.0 -name "Mac allow").MacAddress
# удалить MAC
$d.Remove("24-e3-14-82-6c-86")
# добавить EQ
$res = ($d | ?{$_ -ne "EQ"} | sort) -join ",EQ," -replace '^(.*)','EQ,$1' -split ","
# сохранить политику
Set-DhcpServerv4Policy -ScopeId 172.16.36.0 -Name "Mac allow" -MacAddress $res
- Details
- Written by: po3dno
- Category: Power Shell
- Hits: 816
$user = [ADSI]"WinNT://domain/username,user"
$AdminGroup = [ADSI]"WinNT://$host/Пользователи удаленного рабочего стола,group";
$AdminGroup.Add($user.Path)
- Details
- Written by: po3dno
- Category: Power Shell
- Hits: 831
$ObjUser = [ADSI]"WinNT://$computer/$user"
$ObjUser.IsAccountLocked = $false
- Details
- Written by: po3dno
- Category: Power Shell
- Hits: 877
PS C:\> $def = @"
public class ClientCertWebClient : System.Net.WebClient
{
System.Net.HttpWebRequest request = null;
System.Security.Cryptography.X509Certificates.X509CertificateCollection certificates = null;
protected override System.Net.WebRequest GetWebRequest(System.Uri address)
{
request = (System.Net.HttpWebRequest)base.GetWebRequest(address);
if (certificates != null)
{
request.ClientCertificates.AddRange(certificates);
}
return request;
}
public void AddCerts(System.Security.Cryptography.X509Certificates.X509Certificate[] certs)
{
if (certificates == null)
{
certificates = new System.Security.Cryptography.X509Certificates.X509CertificateCollection();
}
if (request != null)
{
request.ClientCertificates.AddRange(certs);
}
certificates.AddRange(certs);
}
}
"@
PS C:\> Add-Type -TypeDefinition $def
S C:\> $wc = New-Object ClientCertWebClient
PS C:\> $certs = dir cert:\CurrentUser\My
PS C:\> $wc.AddCerts($certs)
PS C:\> $wc.DownloadString("http://stackoverflow.com")