Last exam of the year, SC-300!
Monday, December 06, 2021
Wednesday, September 22, 2021
Execute PowerShell in Windows Scheduled Task
There are many ways to execute PowerShell in Windows scheduled tasks:
Option #1
Program/Script: PowerShell.exe
Add arguments (optional): -command "& {& 'C:\path\to\script.ps1'}"
Start in (optional): C:\path\to\
Option #2
Program/Script: PowerShell.exe
Add arguments (optional): -NonInteractive -Noprofile -File "C:\path\to\script.ps1"
Start in (optional): C:\path\to\
Option #1 allows me to have the script to connect to the Internet (server is located behind corporate proxy).
Sunday, June 27, 2021
Passed AZ-303
It is official! after passing AZ-303 today, I am now a Microsoft Certified Azure Solutions Architect Expert.
Sunday, May 30, 2021
Passed AZ-304
Today, I passed AZ-304 exam !
One more to go to get Azure Solution Architect Expert
Monday, April 19, 2021
Microsoft Azure Administrator Associate
Tuesday, December 22, 2020
Microsoft Certified: Azure Security Engineer Associate
Passed AZ-500 today!!
Friday, June 12, 2020
Hyper-V Nested VM
> Set-VMProcessor -VMname MyVM -ExposeVirtualizationExtensions $true
Friday, May 15, 2020
Found the attached document which basically helped me recover my iSCSI LUNs. I copied by iSCSI LUN files to the backup locations and rebuild by NAS volumes. I then follow the procedure #3 in the document to get my iSCSI LUNs back.
Wednesday, April 15, 2020
Ubuntu DNS Stub Listener #Disable
PiHole will give errors about Binding error
To disable Ubuntu running as DNS Stub Listener, do the followings:
> sudo vi /etc/systemd/resolved.conf
un-comment #DNSStubListener=yes
change it to DNSStubListener=no
> sudo service systemd-resolved restart
> sudo systemctl disable systemd-resolved.service
> sudo systemctl stop systemd-resolved
> sudo mv /etc/resolv.conf /etc/resolv.conf.old
> sudo shutdown -h now -r
Monday, March 02, 2020
Friday, February 14, 2020
Wednesday, January 08, 2020
PowerShell and Excel
Microsoft Excel cannot access the file
There are several possible reasons:
The file name or path does not exist.
The file is being used by another program.
The workbook you are trying to save has the same name as a currently open workbook.
In turns out, I need to create a directory named: Desktop
In the following locations:
64-Bit OS
C:\Windows\SysWOW64\config\systemprofile\Desktop
32-Bit OS
C:\Windows\System32\config\systemprofile\Desktop
Tuesday, December 31, 2019
QBE CIO Award 2019
All the hard work is paid for ... QBE Cyber Security team has been recognized for exceptional performance!!
Friday, November 22, 2019
Tail in PowerShell
I need to "tail" in PowerShell to view the log and found the following command interesting:
> Get-Content C:\mylog.txt -Wait
If you want to get the latest file and tail it:
> Get-Content ( Get-ChildItem C:\Folder\ | Sort-Object LastWriteTime | Select-Object -Last 1) -Wait
Thursday, September 12, 2019
Active Directory Group Policy by Powershell
Use the following Powershell to get all the GPO dumped to HTML files
#> Get-GPO -All -Domain mydomain.tld | % { Get-GPOReport -Guid $_.Id -ReportType Html -Domain mydomain.tld | Set-Content C:\Reports\$($_.DisplayName).html }
Monday, August 19, 2019
Gartner Security & Risk Management Summit 2019
Thursday, August 15, 2019
Thursday, July 18, 2019
Fix Corrupted Windows 10 File(s)
One time, second time, third time were fine. Finally, one day, I wasn't able to open any ZIP file. It looked like the OS lost its association with the file type .ZIP. I went to the default file type program and could not find .zip file type. I then checked my other healthy Windows 10 machine and clearly there is no .zip file type association either.
To fix this I ran:
> sfc /scannow
When the scan was completed, I checked the log file, it had:
Could not reproject corrupted file \??\C:\WINDOWS\System32\\zipfldr.dll; source file in store is also corrupted
What I did next:
> DISM.exe /Online /Cleanup-image /Restorehealth
Then
> sfc /scannow
and I can open ZIP files again!! :)
Thursday, June 20, 2019
C# + Active Directory = Awesome!!
I have a need to review AD groups and local admin groups as part of the identity project - to identity users who are having privileged access in AD or servers. I developed this tool to help with the quick search, detailed view, export, etc with UI.
Obviously this can be done with PowerShell, but I found there is limitation with PowerShell in regards to recursive lookup especially when dealing with foreign objects
As you can see below, there are different account type you can query, user, computer and group (with recursive option). You can also provide a different credential to query Active Directory as well as specifying a particular OU, LDAP filter and keyword doing the search.
Friday, May 17, 2019
GoDaddy DNS Update Using API
You need to generate the API key and secret.
create the file below and cronjob it!
#!/bin/bash
domain="domain.tld"
type="A"
name="@"
ttl="3600"
port="1"
weight="1"
key="my-api-key"
secret="my-api-secret"
headers="Authorization: sso-key $key:$secret"
echo "Headers = " $headers
result=$(curl -X GET -H "$headers" "https://api.godaddy.com/v1/domains/$domain/records/$type/$name")
echo "Result = " $result
dnsIP=$(echo $result | grep -oE "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b")
echo "DNS IP = " $dnsIP
ret=$(curl -s GET "http://ipinfo.io/json")
currentIP=$(echo $ret | grep -oE "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b")
echo "Current IP = " $currentIP
if [ $dnsIP != $currentIP ];
then
echo "IP's are not equal, updating record"
curl -X PUT "https://api.godaddy.com/v1/domains/$domain/records/$type/$name" \
-H "accept: application/json" \
-H "Content-Type: application/json" \
-H "$headers" \
-d "[ { \"data\": \"$currentIP\", \"port\": $port, \"priority\": 0, \"protocol\": \"string\", \"service\": \"string\", \"ttl\": $ttl, \"weight\": $weight } ]"
fi
if [ $dnsIP = $currentIP ];
then
echo "IP's are equal, no update required"
fi












