Find a user’s Security Identifier (SID) in the Windows registry

  1. 1. Open Registry Editor: Launch the Registry Editor by typing regedit in the Run dialog or search bar. 
  2. 2. Navigate to ProfileList: Go to the following registry key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList
  3. 3. Locate SIDs: You’ll find several subkeys under ProfileList. These subkeys are identified by their unique SID strings, which typically start with “S-1-5″. 
  4. 4. Identify User: For each SID, examine the ProfileImagePath value. 
  5. 5. Match Profile Path: The ProfileImagePath value will contain the path to the user’s profile directory (e.g., C:\Users\Username). Match this path with the corresponding user account to determine the SID. 
  6. 6. Record SID: Once you’ve identified the user and their SID, you can record it for future reference. 

For example, if the ProfileImagePath under a specific SID is C:\Users\JohnDoe, then that SID belongs to the user “JohnDoe". 

Disable Fedora Cockpit

service cockpit stop
service cockpit.socket stop
systemctl disable cockpit
systemctl disable cockpit.socket
systemctl mask cockpit.socket
systemctl mask cockpit

How to determine the version of the Backup Exec Remote Agent for Linux and Unix Servers (RALUS)

Reference

https://www.veritas.com/support/en_US/article.100017645

1.  Open a Terminal Window on the Linux/UNIX computer 

2.  Change to the “/opt/VRTSralus/bin" directory

3.  Run 

strings beremote | grep Version
[root@testing /opt/VRTSralus/bin]# strings beremote | grep Version
_ZN12NdmpdSession38ndmpClientProtocolSupportsTybeeVersionEv
_Z14ndmpGetVersionPv
_Z14ndmpSetVersionPvt
VERITAS_Backup_Exec_File_Version=24.0.1041.0

How to Schedule Power Management in macOS Ventura

Reference

https://www.macrumors.com/how-to/schedule-shut-down-boot-up-macos-ventura/

Schedule Your Mac to Shut Down

To schedule your Mac to shut down each weekday at 7pm, you would input:

sudo pmset repeat shutdown MTWRF 19:00:00

Schedule Your Mac to Restart

To schedule your Mac to reboot every day of the week at midnight, you would input:

sudo pmset repeat restart MTWRFSU 00:00:00

View the Currently Active Schedule

To view the currently active schedule, you can use the following command (this can also be useful if you just want to double-check a schedule you just set up):

pmset -g sched

Clear the Currently Active Schedule

If you want to clear the current power management schedule for your Mac, use the following command:

sudo pmset repeat cancel


You can also specify days of the week using the following letters:

  • Monday is M
  • Tuesday is T
  • Wednesday is W
  • Thursday is R
  • Friday is F
  • Saturday is S
  • Sunday is U

Detecting Failed Login Attempts with PowerShell

Reference

https://demetriusdev.com/detecting-failed-login-attempts-with-powershell

$FailedLogins = Get-EventLog -LogName Security | Where-Object { $_.EventID -eq 4625 }

$Counter = 0
$OutputFile = "FailedLogins.txt"
foreach ($Event in $FailedLogins) {
$UserName = $Event.ReplacementStrings[5]
$SourceIP = $Event.ReplacementStrings[19]
$EventTime = $Event.TimeGenerated
$Output = "Failed login attempt for user '$UserName' from IP address '$SourceIP' at $EventTime"
Write-Output $Output
$Output | Out-File -Append $OutputFile

$Counter++
if ($Counter -eq 100) {
$Counter = 0
Read-Host "Press Enter to continue..."
}
}

How To Find Oracle Database Memory Usage(SGA and PGA)

Reference

SQL> set lines 1000
SQL> set pages 1000
SQL> SELECT sn.INSTANCE_NUMBER,
sga.allo sga,
pga.allo pga,
(sga.allo + pga.allo) tot,
TRUNC (SN.END_INTERVAL_TIME, 'mi') time
FROM ( SELECT snap_id,
INSTANCE_NUMBER,
ROUND (SUM (bytes) / 1024 / 1024 / 1024, 3) allo
FROM DBA_HIST_SGASTAT
GROUP BY snap_id, INSTANCE_NUMBER) sga,
( SELECT snap_id,
INSTANCE_NUMBER,
ROUND (SUM (VALUE) / 1024 / 1024 / 1024, 3) allo
FROM DBA_HIST_PGASTAT
WHERE name = 'total PGA allocated'
GROUP BY snap_id, INSTANCE_NUMBER) pga,
dba_hist_snapshot sn
WHERE sn.snap_id = sga.snap_id
AND sn.INSTANCE_NUMBER = sga.INSTANCE_NUMBER
AND sn.snap_id = pga.snap_id
AND sn.INSTANCE_NUMBER = pga.INSTANCE_NUMBER
ORDER BY sn.snap_id DESC, sn.INSTANCE_NUMBER;

開啟或關閉 WSUS server (Registry)

Reference

http://mytoregistry.blogspot.com/2018/10/wsus-server.html

開啟對應WSUS:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate]
“WUServer"="http://WSUS IP:8530″
“WUStatusServer"="http://WSUS IP:8530″

[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU]
“NoAutoUpdate"=dword:00000000
“AUOptions"=dword:00000003
“UseWUServer"=dword:00000001

————————————————————————————-

關閉對應WSUS:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate]

“WUServer"=-

“WUStatusServer"=-

[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU]

“NoAutoUpdate"=-

“AUOptions"=-

“UseWUServer"=-

HOW TO MAKE A BOOTABLE USB STICK FROM AN ISO FILE ON AN APPLE MAC OS X

Reference:

https://www.lewan.com/blog/2012/02/10/making-a-bootable-usb-stick-on-an-apple-mac-os-x-from-an-iso

  1. Download the desired file
  2. Open the Terminal (in /Applications/Utilities/ or query Terminal in Spotlight)
  3. Convert the .iso file to .img using the convert option of hdiutil:
    hdiutil convert -format UDRW -o /path/to/target.img /path/to/source.iso
    Note: OS X tends to put the .dmg ending on the output file automatically. Rename the file by typing:
    mv /path/to/target.img.dmg /path/to/target.img
  4. Run diskutil list to get the current list of devices
  5. Insert your flash media
  6. Run diskutil list again and determine the device node assigned to your flash media (e.g. /dev/disk2)
  7. Run diskutil unmountDisk /dev/diskN (replace N with the disk number from the last command – in the previous example, N would be 2)
  8. Execute sudo dd if=/path/to/downloaded.img of=/dev/rdiskN bs=1m (replace /path/to/downloaded.img with the path where the image file is located; for example, ./ubuntu.img or ./ubuntu.dmg).
    Note: Using /dev/rdisk instead of /dev/disk may be faster.
    Note: If you see the error dd: Invalid number '1m', you are using GNU dd. Use the same command but replace bs=1m with bs=1M.
    Note: If you see the error dd: /dev/diskN: Resource busy, make sure the disk is not in use. Start the ‘Disk Utility.app’ and unmount (don’t eject) the drive.
  9. Run diskutil eject /dev/diskN and remove your flash media when the command completes

Setting Up Certificate Authorities (CAs) in Firefox

Windows Enterprise Support

Starting with version 49, Firefox can be configured to automatically search for and import CAs that have been added to the Windows certificate store by a user or administrator.

  1. Enter “about:config” in the address bar and continue to the list of preferences.
  2. Set the preference “security.enterprise_roots.enabled" to true.
  3. Restart Firefox.

SQL Server express service is not starting

FCB::Open failed: Could not open file e:\sql11_main_t.obj.x86release\sql\mkmastr\databases\objfre\i386\MSDBData.mdf for file number 1. OS error: 3(The system cannot find the path specified.).

Reference:

https://serverfault.com/questions/447808/sql-server-express-service-is-not-starting

NET START MSSQL$SQLEXPRESS /f /T3608

SQLCMD -S .\SQLEXPRESS

1>SELECT name, physical_name, state_desc FROM sys.master_files ORDER BY database_id;

Now notice those wrong file names; and run following commands ...

Note: you need to change the file name location ..

1>ALTER DATABASE model MODIFY FILE ( NAME = modeldev, FILENAME = 'c:\model.mdf');
2>ALTER DATABASE model MODIFY FILE ( NAME = modellog, FILENAME = 'c:\modellog.ldf');
3> go

ALTER DATABASE msdb MODIFY FILE ( NAME = MSDBData, FILENAME = 'c:\MSDBData.mdf');
ALTER DATABASE msdb MODIFY FILE ( NAME = MSDBLog, FILENAME = 'c:\MSDBLog.ldf');

ALTER DATABASE tempdb MODIFY FILE ( NAME = tempdev, FILENAME = 'c:\temp.mdf');
ALTER DATABASE tempdb MODIFY FILE ( NAME = templog, FILENAME = 'c:\temp.ldf');

go

exit;

NET STOP MSSQL$SQLEXPRESS 

How to change the Password never expires attribute and set a password expiration date using PowerShell

Reference:

https://www.manageengine.com/products/self-service-password/powershell/how-to-change-password-never-expires-attribute-and-expiration-date.html

Set the Password never expires attribute

To set the Password never expires attribute for AD users:

$User = (Read-Host -Prompt “Username")
Set-ADUser -Identity $User -PasswordNeverExpires $true

Set the password expiration date

You can extend the validity of an AD password by setting the pwdlastset attribute to -1, which sets the value of the attribute to the current date and time.

$Username = (Read-Host -Prompt “Username")
$User = Get-ADUser $Username -Properties pwdlastset
$User.pwdlastset = 0
Set-ADUser -Instance $User
$User.pwdlastset = -1
Set-ADUser -Instance $User

在 WordPress.com 建立免費網站或部落格.

向上 ↑

使用 WordPress.com 設計專業網站
立即開始使用