I want to upload these local files from system to the fileserver but if i try to use Get-ChildItem I get this message:
Cannot convert argument "address", with value: "System.Object[]", for "Downl convert the "System.Object[]" value of type "System.Object[]" to type "Syste At C:\Users\Administrator\Desktop\MOVEFILES2.ps1:23 char:1 + $WebClient.DownloadFile($Source, $Dest) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [], MethodException + FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument
Here is the working script. I want to modify so that it pulls from that path and not having to specify the file name.
#UPLOAD FILES FROM SOURCE TO File server
# Specify the path to the documents you want to upload from the local machine...
$Source = "C:\Users\Administrator\Desktop\SourceFolder\Goober.docx"
$Dest = "\\10.112.4.111\xx\xxxxx\xxxx xxxxx\xxxx\Goober.docx"
# Specify Username and Password
$Username = "domain\user"
$Password = "xxxxxxxxxxx"
# Generate System.Net.WebClient object
$WebClient = New-Object System.Net.WebClient
$WebClient.Credentials = New-Object System.Net.NetworkCredential($Username, $Password)
$WebClient.DownloadFile($Source, $Dest)
Copy-Item
? – sodawillow