1 Rookie
•
34 Posts
0
772
Creating a multi lines Directive with Powershell
Networker Server 19.3
I am trying to create a Directive with multiple lines from a Powershell script
For example, I'd like it to contain the following lines:
<< "c:\temp" >>
skip: *
<< / >>
+compressasm: .
I had partial success, I created a txt file (directive.txt) with the following content:
create type: NSR directive; name:SkipTemp;directive: << "\"c:\\temp"\" >> "skip: *"
I then called it from powershell like this:
cmd.exe /c "nsradmin -i .\src\directive.txt"
It worked, the directive was created, however everything in the directive is on a single line, I need to script a directive with 10 lines and not sure how to achieve it.
Any advice will be appreciated!
barry_beckers
393 Posts
0
May 4th, 2023 12:00
Your directive.txt does not show here that it contains even multiple entries, it only states one? On a Linux NW server I'd add a directive via an input file similarly. My input file contains enters at the end of each line.
As you can see I leave out various quotes that you use.
However I don't ever work from Windows. Only Linux backup servers.
VictorGh
1 Rookie
1 Rookie
•
34 Posts
0
May 4th, 2023 12:00
I found the answer, the directive.txt need to contain the following (with an empty new line at the very end):
create type: NSR directive; name:SkipTemp2;directive:"
<< \"c:\\temp\" >>
skip: *
<< / >>
+compressasm: .
";
VictorGh
1 Rookie
1 Rookie
•
34 Posts
0
May 4th, 2023 14:00
That worked like a charm, thank you !!