Friday, September 22, 2023

Add "on connection to user session" for task scheduler

With powershell:

$TaskPath = "\"
$TaskName = "test"
$Action = New-ScheduledTaskAction -Execute "PowerShell.exe" -Argument "D:\123.ps1"
$Trigger = New-ScheduledTaskTrigger -AtLogOn
$ScheduledTask = New-ScheduledTask -Action $action -Trigger $trigger
Register-ScheduledTask -TaskName "$TaskPath$TaskName" -InputObject $ScheduledTask
$triggersession = "  <Triggers>
    <SessionStateChangeTrigger>
      <Enabled>true</Enabled>
      <StateChange>RemoteConnect</StateChange>
    </SessionStateChangeTrigger>
    <SessionStateChangeTrigger>
      <Enabled>true</Enabled>
      <StateChange>ConsoleConnect</StateChange>
    </SessionStateChangeTrigger>"
$taskoutput = Export-ScheduledTask -TaskName $TaskName -TaskPath $TaskPath
$taskoutput = $taskoutput -replace "  <Triggers>", $triggersession
Register-ScheduledTask -Xml $taskoutput -TaskName "$TaskPath$TaskName" -force

Monday, September 11, 2023

SAS比SATA好

 高延遲的SAS好性能過低延遲的SATA 因爲有cache?

Friday, March 03, 2023

Browse https failed

The thing happen like this, i found out my browser cant not work for all https website (which previous day still can browse)

Here is the action i do:

1) Try different browser (chrome, firefox, IE, edge(new), opera(new)), even use powershell to invoke it.
* after some day, i install comodo browser, and it is work.
2) Restart windows
3) Reset firefox setting/profile. reinstall chrome/firefox.
4) Dism restorehealth, sfc
5) Windows update
6) Change local ip, reset network winsock
7) Change timezone, change different time
8) On/Off firewall.
9) Use some tool to monitor (
Procmon64,procexp64 and so on)
10) Also use wireshark/openssl (it show TLS have some problem, but i not too sure how to fix it)

** there is few time after the setting change (not too remember what the action - windows update/reset network winsock), the https is work, but after a second, it failed again.

Below is error show on browser:
Chrome:  This site can’t be reached, www.yahoo.com unexpectedly closed the connection.
Firefox:
Secure Connection Failed, Error code: PR_END_OF_FILE_ERROR.

After few day of checking, i try to rejoin domain. After this, everything is work as normal. DAMM
Any expert can tell me what goes wrong?



Friday, September 23, 2022

In Ubuntu. when you get this error.
java.lang.NoClassDefFoundError: org/tanukisoftware/wrapper/WrapperListener
Maybe you can try set app.parameter(wrapper.conf) as below.

wrapper.app.parameter.1=
wrapper.app.parameter.2=YourParamenter


Let first row empty, due to it can not detect the parameter from first row.

My environment:
wrapper version 3.3.9
ubuntu server 20.04
java 8

Sunday, March 20, 2022

Send multiple attacment with powershell email

Here is the sample:

Send-MailMessage -From $emailfrom  -To $emailto -Credential $Credential -SmtpServer $emailserver -port $emailport -Subject "testing" -body $emailbody -attachment @("D:\1.txt","D:\2.txt","D:\3.txt")


Friday, August 06, 2021

Bring up internet on WSL2

I try install kali in WSL.
For WSL1, after install can online directly, but for WSL2, there is no internet, so here i show the step i fix it.

Solution for my case:
1) Need to enable hyper-v feature, and after bring up the kali instance, set the vEthernet(WSL) virtual switch to external.
2) Share LAN/WIFI internet for vEthernet(WSL). WSL ip will probably change to 192.168.137.1
3) in kali:
- add IP (eg 192.168.137.2) to eth0.
- bring up the eth0 and lo adapter
- add default route (to 192.168.137.1)
4) /etc/resolv.conf:
nameserver 192.168.137.1
5) add /etc/wsl.conf
[network]
generateResolvConf = false

* everytime you shutdown the kali or restart your windows, those setting will reset.
you will need to re-do the step (2) and (3),




Friday, July 09, 2021

Win10 unable to burn DVD

Windows 10 latest update unable to burn DVD
Here is my case. I have 3 device as below.
Device AA: Desktop PC
Device BB: Desktop PC (2017)
Device CC: Dell inspiron 57XX (2018)
All with win 10 latest update ( 10.0.19043), and Asus DVD RW.

Before this latest windows update.
I success burn the DVD with Device CC, and also Device AA at year 2018.
But today 3 of device fail to burn the DVD, suspect cause by win10 OS.
I do online check, and try most of the way, but it didnt work.

This is the Error i get:
1) When i click on DVD Drive (with empty disc inside)
Windows cant read the disc in drive E:\
Make sure that the disc uses a format that windows recognizes. if the disc is unformatted, you need to format it before using it.
2) When i right click eject the DVD Drive:
An erroroccurred while ejecting 'DVD RW Drive (F:)'.
* but i able to right click eject CD-ROM on disk managment.
3) When i try to burner with explorer
I cant drag the file into DVD Drive.
4) Burn with other tool (ashampoo, burnaware ) with admin permission.
Set all the setting, before it burn into disc, it will fail with "medium error" message.
5) on explorer: right click "send to DVD" menu is gone.

And below is some info and the way i try:
1) It is the same DVD i success burn before. so i didnt try other brand of DVD.
this is DVD-R, which match all the device. and when using 3rd party tool, it also show the correct info.
2) Uninstall DVD drive and restart.
3) add atapi/controller0 registry
4) remove registry upper and lower filter (3 of device never have this key)
5) window supdate (currently all is latest update)
6) install DVD driver. with normal driver. for dell , it DVD ultra slim firmware unable to detect DVD Rom.
7) i cant restore back the early update as i need to use it.
8) remove IDE/ATAPI from device manager. (if do have IDE.ATAPI)
9) i cant found hardware troubleshoot for DVD. i run few other device troubleshoot, but it doesnt help.
10) i even do chkdsk /f. but not help.
11) but 3 of them can read DVD-R. which have content.
12) service: Shell Hardware Detection is Running.
13) disable/enable DVD rom on devmgmt.
14) every funny i boot in safe mode. it able to eject (but still cant burn)

15) Add/remove NoCDBurning registry.


Look same to this issue: https://community.spiceworks.com/topic/1734648-windows-7-can-t-read-blank-disc-but-can-read-for-non-blank

------------------------------------
Update:
with early try with 6-7 DVD all failed. the only way i keep try with the rest of 50 blank DVD, there is some DVD can burn.
is this means those (look good DVD) is spoil? since it can detect with 3rd party tool. but cant burn. really make me blur.