Friday, March 22, 2024

Move SQL Temp DB to alternate partition

USE master
GO
ALTER DATABASE tempdb
MODIFY FILE( NAME = temp2, FILENAME = 'F:\MSSQL\DATA\tempdb.mdf' )

ALTER DATABASE tempdb
MODIFY FILE( NAME = templog, FILENAME = 'F:\MSSQL\DATA\templog.ldf')

ALTER DATABASE model
MODIFY FILE( NAME = modeldev, FILENAME = 'F:\MSSQL\DATA\model.mdf' )

ALTER DATABASE model
MODIFY FILE( NAME = modellog, FILENAME = 'F:\MSSQL\DATA\modellog.ldf')

ALTER DATABASE msdb
MODIFY FILE( NAME = MSDBData, FILENAME = 'F:\MSSQL\DATA\MSDBData.mdf' )

ALTER DATABASE msdb
MODIFY FILE( NAME = MSDBLog, FILENAME = 'F:\MSSQL\DATA\MSDBLog.ldf')


Move files, restart service.

Thursday, March 14, 2024

OpenSSL Self Signed Cert / PFX

openssl genpkey -algorithm RSA -out key.pem
openssl req -new -key key.pem -out csr.pem
openssl x509 -req -days 365 -in csr.pem -signkey key.pem -out cert.pem
openssl pkcs12 -export -out certificate.pfx -inkey key.pem -in cert.pem

If it won't take the password-
openssl pkcs12 -export -certpbe PBE-SHA1-3DES -keypbe PBE-SHA1-3DES -nomac -inkey contoso.com.key -in contoso.com.crt -out contoso.com-legacy.pfx


Add Certificate Snap-in:
Go to File > Add/Remove Snap-in.
Select Certificates and click Add.
Choose Computer account and click Next.
Select Local computer and click Finish.
Click OK to close the Add or Remove Snap-ins window.

Import the Certificate:
Expand Certificates (Local Computer) > Personal.
Right-click Certificates and choose All Tasks > Import.
Follow the Certificate Import Wizard to import the certificate from the .pem or .cer file you exported earlier.
Assign the Certificate to LDAPS:


Once imported, locate the certificate in the Certificates (Local Computer) > Personal store.
Right-click on the certificate and choose All Tasks > Manage Private Keys.
Assign appropriate permissions to the private key for the account running the LDAP service (usually NTDS).