Question:
if you execute from C: \ Windows \ system32, then everything is fine, if with D: \ SCRIPTS \ sc.ps1 then everything does not want to, how can this be fixed?
Невозможно загрузить файл D:\SCRIPTS\sc.ps1, так как выполнение сценариев отключено в этой системе. Для получения дополнительных сведений см. about_Execution_Policies по адресу http://go.microsoft.com/fwlink/?LinkID=135170.
+ CategoryInfo : Ошибка безопасности: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : UnauthorizedAccess
here is the code
$ipv4 = (Test-Connection -ComputerName $env:computername -count 1).ipv4address.IPAddressToString
$num = $ipv4.split(".")[-1]
$ie = Invoke-WebRequest -Uri "http://****/indata.php?nt=$num" -Method POST -ContentType "text/plain; charset=utf-8"
Answer:
Solution:
-
We open the terminal from the admin.
-
We write and run: Set-ExecutionPolicy RemoteSigned
-
We answer the question: A (Yes for all)