Hi,
I have this code but need some help to make it better.
# carrega todos os scripts para conhercer as suas funcoes
Write-Host 'A CARREGAR OS SCRIPTS DESENVOLVIDOS'
Get-ChildItem "\\servidor\scripts$\Run\*.ps1" | %{Import-Module $_ -Force}
#Write-Host 'A DORMIR 5 SEG'
#Start-Sleep 5
Set-Variable -Name pcname -Option None
if ($env:computername -eq "PC_Template")
{
#devia carregar uma nova janela interactiva com o script set-novoclone a correr
Write-host 'Correr script para novo clone'
Start-Sleep 1
Start-Process powershell -ArgumentList 'Get-ChildItem "\\servidor\scripts$\Run\*.ps1" | %{Import-Module $_ -Force}; Set-Clone; Read-Host' -verb RunAs
}
else
{
# Define o wallpaper actual
Write-Host 'A DEFENIR WALLPAPER'
#Build-TextOverlay
Set-Wallpaper background.jpg
#aviso para encerramento do espaço
write-host Script de aviso de fecho em backgroud
Start-Job -ScriptBlock {Get-FechoSala} -Name "Fecho"
}
This line below works great and when i call the function Set-Wallpaper it works.
Get-ChildItem "\\servidor\scripts$\Run\*.ps1" | %{Import-Module $_ -Force}
But when i run the script when it pass here
Start-Process powershell -ArgumentList 'Get-ChildItem "\\servidor\scripts$\Run\*.ps1" | %{Import-Module $_ -Force}; Set-Clone; Read-Host' -verb RunAs
it do what it should but the new windows don't know the network link and the windows close with an error.
Please help me to solve this!
TcoUpLoad (Vb6 and VbNet | starting learning C# and LINQ)