Computer Hope

Microsoft => Microsoft DOS => Topic started by: FMartel on February 05, 2020, 10:10:02 AM

Title: batch close after powershell script
Post by: FMartel on February 05, 2020, 10:10:02 AM
Hello all, I need some help with this :

Code: [Select]
@echo off
path %path%; c:\windows\temp
echo ouverture du RDP
powershell -command "Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server' -name "fDenyTSConnections" -value 0"
echo installation de boxstarter
powershell -command "Set-ExecutionPolicy Unrestricted -Force"
powershell -command ". { iwr -useb https://boxstarter.org/bootstrapper.ps1 } | iex; get-boxstarter -Force"
echo copie du script PowerShell vers le dossier temporaire de Windows
copy "\\ftp-stg1\FTP Root\Programs\script\vmprog.ps1" C:\Windows\Temp
echo copie du script CMD vers le dossier temporaire de Windows
copy "\\ftp-stg1\FTP Root\Programs\script\package_install.cmd" C:\Windows\Temp
echo appel du script d installation
call package_install.cmd
exit

the scrip closes after this command
Code: [Select]
powershell -command ". { iwr -useb https://boxstarter.org/bootstrapper.ps1 } | iex; get-boxstarter -Force"the powershell process need to be closed, in order to run this other part of the script
Code: [Select]
echo debut de l'installation des programmes avec choco
powershell -command "Install-BoxstarterPackage -PackageName "C:\Windows\Temp\vmprog.ps1""
whitch is in package_install.cmd.

If possible, I'd like to run all the commands in one single batch...
Let me know if I'm making sens...