for the börnd

🧩 Syntax:
1. For the Windows 7 PC:

Create a createTask.ps1 file with the following content:
______________________________________________________
powershell
Copy code
______________________________________________________
# Task parameters
$taskName = "MyTask"
$taskDescription = "Running test.bat"
$taskCommand = "cmd.exe"
$taskArguments = '/c "C:\temp\test.bat"'
$taskUser = "NT AUTHORITY\SYSTEM"

# Create a new scheduled task
$action = New-ScheduledTaskAction -Execute $taskCommand -Argument $taskArguments
$settings = New-ScheduledTaskSettingsSet
$principal = New-ScheduledTaskPrincipal -UserID $taskUser -LogonType ServiceAccount
Register-ScheduledTask -Action $action -TaskName $taskName -Description $taskDescription -Settings $settings -Principal $principal
_____________________________
This script will create a task that is ready to be run when you send a remote command. This task will not run on a schedule unless you add a trigger.

2. For the Windows 10 PC:

Create a triggerTask.ps1 file with the following content:

powershell
Copy code
______________________________________________________
# Create a secure password
$secStringPassword = ConvertTo-SecureString "PASSWORD" -AsPlainText -Force

# Create a new credential object
$cred = New-Object System.Management.Automation.PSCredential("USERNAME", $secStringPassword)

# Trigger the scheduled task on the remote computer
Invoke-Command -ComputerName "PC_NAME" -Credential $cred -ScriptBlock { Start-ScheduledTask -TaskName "MyTask" }

______________________________________________________
This script will trigger the task "MyTask" that you created on the Windows 7 PC.

Remember to replace "USERNAME", "PASSWORD", and "PC_NAME" with your actual username, password, and the hostname or IP address of your Windows 7 machine.

Important security note: These scripts include a plaintext password. This is a significant security risk. Please consider using a more secure method to store your passwords, as I mentioned in the previous response.