Answer the question
In order to leave comments, you need to log in
How to copy a folder via smb only to turned on computers?
I found sample scripts on the net. Enabled WinRM via logon script.
When I try to copy over a network share from a domain controller through a powershell script, I get an error:
$computername = (Get-ADComputer -LDAPFilter "(&(objectCategory=computer)(!userAccountControl:1.2.840.113556.1.4.803:=8192))" -Properties name | Sort).name;
$src = "\\DC-01\c$\zabbix\*"
foreach ($computer in $computername)
{
$df = "\\$computer\c$\zabbix"
if (!(Test-Path -path $df))
{
New-Item $df -Type Directory
}
Copy-Item -Path $src -Destination $df;
Invoke-Command -ComputerName $computer -ScriptBlock {powershell "& 'C:\zabbix\install.bat'"}
"about_Remote_Troubleshooting".
+ CategoryInfo : OpenError: (WS-01_MELNIK:String) [], PSRemotingTransportException
+ FullyQualifiedErrorId : ComputerNotFound,PSSessionStateBroken
New-Item : Не найден сетевой путь
At line:13 char:9
+ New-Item $destinationFolder -Type Directory
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [New-Item], IOException
+ FullyQualifiedErrorId : System.IO.IOException,Microsoft.PowerShell.Commands.NewItemCommand
Answer the question
In order to leave comments, you need to log in
If you answer based on the question - you can check the availability of the node using Test-NetConnection .
The rest of the things (DNS names are truncated - what is it about? Where?) It is better to discuss in the comments.
Is it not an option to install the zabbix agent through GPO?
PS what will the script do if the computer is turned on and the agent is already installed?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question