Contents
- Format DISK
- disable Windows key(s)
- route ethernet and wireless
- flush Client DNS record
- AD report
- remove failed AD from AD
- emulex/qlogic WWN
- Recover SA Password on Microsoft SQL Server
- IIS for windows2008R2 cluster
- Reset windows2008R2 domain password
- Set Windows IP address
- 遠程桌面超出最大連接數的解決方法之一
- How to extract msu/msp/msi/exe files from the command line
- cifs
- enable remote desktop from commandline
- How to find Windows Product Key All Versions of Windows
- How to find World Wide Name (WWN) in Windows Server 2012 and 2012 R2
- Troubleshooting
Format DISK
diskpart
list disk
select disk {number}
clean
create partition primary
select partition 1
active
format fs=fat32 quick
assign
exit
disable Windows key(s)
https://windowsreport.com/disable-windows-key/
route ethernet and wireless
route delete 0.0.0.0 mask 0.0.0.0 route add 0.0.0.0 mask 0.0.0.0 192.168.1.254 route add 10.7.84.0 mask 255.255.255.0 10.7.84.254
flush Client DNS record
ipconfig /flushdns
AD report
https://gallery.technet.microsoft.com/AD-Mega-Domain-Report-ad7dbada#content
https://www.petri.com/useful-powershell-script-document-active-directory-environment
http://kpytko.pl/active-directory-domain-services/active-directory-reporting/
remove failed AD from AD
http://www.petri.com/delete_failed_dcs_from_ad.htm http://seneej.com/2013/06/30/clean-failedoffline-domain-controllers-from-active-directory/
emulex/qlogic WWN
In Windows Server 2008 or 2008 R2, you can use “Storage Explorer” to show the WWN.
Open MMC (Microsoft Management Console)
Click File > Add / Remove Snapin.
Find Storage Explorer and double-click to add the snapin. Click ok to save and go back to the screen.
The system will scan for adaptors.
Expand Servers > <Server Name>.
Click on the adaptor and the information will be displayed.
Recover SA Password on Microsoft SQL Server
http://community.spiceworks.com/how_to/show/22044-recover-sa-password-on-microsoft-sql-server
IIS for windows2008R2 cluster
http://support.microsoft.com/kb/970759/EN-US http://www.iis.net/learn/manage/managing-your-configuration-settings/shared-configuration_264 http://technet.microsoft.com/en-us/library/dd296641%28WS.10%29.aspx http://blogs.adobe.com/livecycle/2011/03/configuring-iis-7-5-to-load-balance-a-livecycle-cluster.html http://serverfault.com/questions/104369/how-to-setup-iis7-and-sql-server-failover-on-a-windows-server-2008-r2
Reset windows2008R2 domain password
1. 通过Windows2008R2系统安装盘引导进入修复模式。 2. 通过插入U盘加载相应的RAID卡驱动。 3. 进入“命令行模式”后,备份utilman.exe MOVE c:\windows\system32\utilman.exe c:\windows\system32\utilman.exe.bak 4, 复制CMD.EXE为UTILMAN.EXE COPY c:\sindows\system32\cmd.exe c:\windows\system32\utilman.exe 5, 重启系统后点击 6, 现在可以修改密码了。 net user administrator XXXX 7, 最后记得把之前备份的utilman.exe.bak改回utilman.exe,然后重启机器使用新的密码。
Set Windows IP address
netsh interface ip set address name="本地连接" source=static 192.168.1.133 255.255.254.0 gateway=192.168.0.5 gwmetric=2 netsh interface ip set address name="本地连接" source=dhcp netsh interface ipv4 add route 10.0.2.0/24 <NetworkName> 10.0.1.254
遠程桌面超出最大連接數的解決方法之一
mstsc /console /v:172.20.101.51
How to extract msu/msp/msi/exe files from the command line
Microsoft Hotfix Installer (.exe)
setup.exe /t:C:<target_dir> /c Microsoft Update Standalone Package (.msu)
expand -F:* update.msu C:<target_dir> cd <target_dir> expand -F:* update.cab C:<target_dir> Microsoft Patch File (.msp)
msix patch.msp /out C:<target_dir> msix.zip Windows Installer Package (.msi)
msiexec /a setup.msi /qb TARGETDIR=C:<target_dir> }}}
# http://technet.microsoft.com/en-us/library/ee441258(v=ws.10).aspx
cifs
mount -t cifs -o credentials=/root/credentials,iocharset=utf8,file_mode=0777,dir_mode=0777,nodfs //nas.systec.com.cn/Share /mnt/zip
enable remote desktop from commandline
First 1
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0 /f
Configure Machine Firewall to allow RDP
Open a command line and type the following
psexec \\remotecomputername netsh firewall set service remoteadmin enable psexec \\remotecomputername netsh firewall set service remotedesktop enable:
To enable Remote assistance
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fAllowToGetHelp /t REG_DWORD /d 1 /f
To disable remote desktop we need to run the below command
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 1 /f
How to find Windows Product Key All Versions of Windows
- get-keys.ps1
function Get-WindowsKey {
## function to retrieve the Windows Product Key from any PC
## by Nedim Mehic
param ($targets = ".")
$hklm = 2147483650
$regPath = "Software\Microsoft\Windows NT\CurrentVersion"
$regValue = "DigitalProductId"
Foreach ($target in $targets) {
$productKey = $null
$win32os = $null
$wmi = [WMIClass]"\\$target\root\default:stdRegProv"
$data = $wmi.GetBinaryValue($hklm,$regPath,$regValue)
$binArray = ($data.uValue)[52..66]
$charsArray = "B","C","D","F","G","H","J","K","M","P","Q","R","T","V","W","X","Y","2","3","4","6","7","8","9"
## decrypt base24 encoded binary data
For ($i = 24; $i -ge 0; $i--) {
$k = 0
For ($j = 14; $j -ge 0; $j--) {
$k = $k * 256 -bxor $binArray[$j]
$binArray[$j] = [math]::truncate($k / 24)
$k = $k % 24
}
$productKey = $charsArray[$k] + $productKey
If (($i % 5 -eq 0) -and ($i -ne 0)) {
$productKey = "-" + $productKey
}
}
$win32os = Get-WmiObject Win32_OperatingSystem -computer $target
$obj = New-Object Object
$obj | Add-Member Noteproperty Computer -value $target
$obj | Add-Member Noteproperty Caption -value $win32os.Caption
$obj | Add-Member Noteproperty CSDVersion -value $win32os.CSDVersion
$obj | Add-Member Noteproperty OSArch -value $win32os.OSArchitecture
$obj | Add-Member Noteproperty BuildNumber -value $win32os.BuildNumber
$obj | Add-Member Noteproperty RegisteredTo -value $win32os.RegisteredUser
$obj | Add-Member Noteproperty ProductID -value $win32os.SerialNumber
$obj | Add-Member Noteproperty ProductKey -value $productkey
$obj
}
}excute in powershell
Set-ExecutionPolicy RemoteSigned Import-Module C:\Users\Administrator\Desktop\get-keys.ps1; Get-WindowsKey
How to find World Wide Name (WWN) in Windows Server 2012 and 2012 R2
In Windows Server 2008 or 2008 R2, we can use "Storage Explorer" to locate World Wide Name (WWN). Started from Windows Server 2012, "Storage Explorer" was removed. To find WWN in Windows Server 2012 or 2012 R2, we can use PowerShell to perform "Get-InitiatorPort".
Troubleshooting
Troubleshooting SSL related issues (Server Certificate)
n the non-working scenario, the client was configured to use TLS 1.1 and TLS 1.2 only. However, the web server was IIS 6, which can support until TLS 1.0 and hence the handshake failed. Do check the registry keys to determine what protocols are enabled or disabled. Here's the path: console HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols The "Enabled" DWORD should be set to "1". If "0" then the protocol is disabled. For e.g. SSL 2.0 is disabled by default.
Tracert
@ECHO OFF
echo Script run on %date% at %time% > output.log
FOR /F %%S IN (SERVERS.TXT) DO (
for /F %%a in ('echo %%S') do <nul>>output.log set /p =%%a
TRACERT -d -w 3 %%S >> output.log
)
activatioin win10/11
irm https://massgrave.dev/get | iex
