Copy the following syntax and change the values marked in red color according to your need. In the first one give the full path to your file. In the second place with this file name you are going to save your file in the root.
$fileBytes = [system.io.file]::ReadAllBytes("
c:\the\full\path\to\your\file.txt
");$site = Get-SPSite "http://sharepoint1";
$site.RootWeb.Files.Add("robots.txt", $fileBytes, $true);
Open the PowerShell as administrator then just copy and execute.
This will result in a robots.txt located at “http://yourdomain:portifneeded/file.txt”.
Be Happy !!! :)
No comments:
Post a Comment