카테고리 없음

sql server 로 .net framework 와 powershell 깔아보기

보미아빠 2019. 2. 1. 16:16

sql 은 localhost 나 admin 권한이 있다고 가정.


declare @sql varchar(8000) = 'exec xp_cmdshell ''@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString(''''https://chocolatey.org/install.ps1''''))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"'''

print @sql 

exec (@sql)


declare @sql varchar(8000) = 'exec xp_cmdshell ''choco install dotnet4.7.2 -y'''

print @sql 

exec (@sql)


declare @sql varchar(8000) = 'exec xp_cmdshell ''choco install powershell -y'''

print @sql 

exec (@sql)


끝...