2021-10-26

列出特定 OU 下帳號的密碼到期日 & 重設密碼到期日

Get-ADUser -filter {Enabled -eq $True -and PasswordNeverExpires -eq $False} -SearchBase "OU=CorpUsers,DC=contoso,DC=com" –Properties "DisplayName", "msDS-UserPasswordExpiryTimeComputed","passwordlastset","Passwordneverexpires","LockedOut" | Select-Object -Property "Displayname","passwordlastset",@{Name="ExpiryDate";Expression={[datetime]::FromFileTime($_."msDS-UserPasswordExpiryTimeComputed")}},"Passwordneverexpires","LockedOut" | ft

搭配以下指令重設密碼到期日

set-aduser -ChangePasswordAtLogon:$true
set-aduser -ChangePasswordAtLogon:$false

2021-10-07

市場開發必須要先擁有的基本功

今天接到了一通推銷電話,來電的人自稱是 Google 的某某合作夥伴
他說:「我們公司最近針對你們這類型的產業要舉辦一個活動來介紹產品
想跟您請教 E-mail Address 把資訊寄給您參考」

他真的就只有說了這些,就要我講出 E-mail Address
各位要知道,Google 的合作夥伴何其多啊
於是我問他: 你們是哪一家公司啊?
他說: xx 科技
我繼續問: xx 怎麼寫呢?
於是對方一面說,我就一面 Google
在搜尋的時候我當然是沒說話的
於是他在沉默的空檔又問了一次 E-mail Address

這個時候我找到了他們家網站,也看到了他們家的英文名字
基於要確認我找到的這家公司對不對,於是我唸出了他們公司的英文名字 (消音)
這個時候,他的回應真是令人啼笑皆非
他重複唸了一遍我剛剛唸出的他們公司的英文名
接著問我: 怎麼拚呢?
當下我真得是愣住了,陷入了沉默...
如果你要問我停頓了多久,我想大概有一萬年吧
當我從驚嚇中恢復過來,再重複唸了一次他們公司的英文名
他才恍然大悟: 哦這是我們公司的名字...

2021-09-09

Powershell 對於檔名有 [ 中括弧 ] 等保留字元的不適應症狀處理 Deal with filename contains reserved characters like [ ] in Powershell

Get-ChildItem 明明找得到 [ABC].txt,但用 Get-Item 卻找不到


雖然改用 [System.IO.File] 就能正確存取
且在 這邊 (微軟官方文件) 可以找到相關的 Method 來使用,但還是相當不方便
畢竟不是所有指令都能用 [System.IO.File] 來代替


2021-09-03

Silently Install UltraVNC 無訊息安裝

先安裝一次並加上 /saveinf 參數取得設定值參考檔
setup.exe /saveinf="C:\UVNCInstall.inf"

加上 /verysilent 及 /loadinf 來實現無訊息安裝
setup.exe /verysilent /loadinf="C:\silentinstall.inf"

Reference

2021-08-19

Fix Unable to resolve package source when Install-Module with PowerShell

Install-Module -Name AzureAD 的時候發生以下錯誤:

WARNING: Unable to resolve package source 'https://www.powershellgallery.com/api/v2/'.

可能的原因為 PowerShell 採用 TLS 1.0 的加密方式去溝通
解決辦法: 執行以下指令要求 PowerShell 用 TLS 2.0 加密連線

2021-07-29

Auto Renew Let's Encrypt Certificate for SoftEther

After build up the SoftEther VPN https://youtu.be/Y1F4PJOsWF8


You can manually Import the Certificate


Or try to make it automatically.

Place Cert in C:\Cert\ and write a TXT file (C:\Cert\SoftEtherVPNCertBatch.txt) with the following command:

2021-07-08

WFH (Work From Home) 的情況下如何 Reset Computer Account Password

這個應該是用不到啦,畢竟就已經跟網域脫離關係,應該是用 Cache Credential 來登入作業系統
所以應該不會遇到 Computer Account Password 說過期,失去網路信任關係的問題

但如果有需要的話,VPN 先連上,然後下 PowerShell 指令

Test-ComputerSecureChannel -server DC.Contoso.com -credential Contoso\Adminstrator -repair