顯示具有 CMD與PowerShell 標籤的文章。 顯示所有文章
顯示具有 CMD與PowerShell 標籤的文章。 顯示所有文章

2024年10月19日 星期六

Windows上看DNS服務用Get-DnsClientServerAddress

【DNS】Windows查看和清理DNS缓存在Windows裡面要看DNS被設定到查詢哪些機器,可用PowerShell指令:

  1. Get-DnsClientServerAddress
  2. Get-DnsClientServerAddress -AddressFamily IPv4
  3. Get-DnsClientServerAddress -AddressFamily IPv6

上述指令的意思是:

2023年12月22日 星期五

Windows的RDCMan設定檔

Windows 11的R遠端桌面管理員RDCMan(Remote Desktop Connection Manager)設定檔案叫做RDCMan.settings,如果是用命令提示字元(CMD)用下列指令到存放設定的資料夾: 

  • cd "C:\Users\%username%\AppData\Local\Microsoft\Remote Desktop Connection Manager"
  • dir RDCMan.settings

若是PowerShell,則要用下列指令:

2023年11月30日 星期四

Windows用指令產生隨機密碼

在Windows上可以下面的PowerShell產生長度為12個字元的隨機密碼:

$Password = New-Object -TypeName PSObject
$Password | Add-Member -MemberType ScriptProperty -Name "Password" -Value { ("!@#$%^&*123456789ABCDEFGHJKLMNOPQRSTUVWXYZ_abcdefghijkmnopqrstuvwxyz".tochararray() | sort {Get-Random})[0..12] -join '' }
echo $Password

使用方式為開啟Windows的PowerShell後,貼上上述的指令即可產生密碼。上述的0..12這邊可以調整12這個數字,密碼的長度就是12+1=13個字元。為了避免麻煩,把0(數字)、I(大寫i)、l(小寫L)從產生密碼的列表裡面拿走避免一些麻煩