|
|
Data ONTAP® PowerShell Toolkit
|
Cmdlet: Write-NaFile
NAME
Write-NaFile
SYNOPSIS
Write data into a named file.
SYNTAX
Write-NaFile [-Path] <String> -Data <String[]> [-NoOverwrite] [-Append] [-Ap
pendLine] [-NoTruncate] [-Controller <NaController>] [-Offset <Int64>] [-War
ningAction <ActionPreference>] [-WarningVariable <String>] [<CommonParameter
s>]
Write-NaFile [-Path] <String> -RawData <Byte[]> [-NoOverwrite] [-Append] [-A
ppendLine] [-NoTruncate] [-Controller <NaController>] [-Offset <Int64>] [-Wa
rningAction <ActionPreference>] [-WarningVariable <String>] [<CommonParamete
rs>]
DESCRIPTION
Write data into a named file. If the file does not previously exist, it wil
l be created - the owner of the file will be root and it will not be readabl
e or writable by non-root users. API will fail if data exceeds 1 MB.
By default, the contents of the file are replaced with the specified data.
Various switches (NoOverwrite, Append, AppendLine, NoTruncate) are supported
to provide control over how the file is modified.
Note that this API is provided primarily for administrative purposes. It is
not intended for high-performance I/O.
PARAMETERS
-Path <String>
Path of the file, i.e. /vol/<volumename>/<filename>.
Required? true
Position? 1
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Data <String[]>
Data to be written. The format of the data is interpreted as .NET strin
gs, which are then converted to ASCII for storage on the controller. Th
is is a convenient means to update text files, such as /etc/hosts, on th
e controller. Use RawData to write bytes directly to the file.
Required? true
Position? named
Default value
Accept pipeline input? true (ByValue, ByPropertyName)
Accept wildcard characters? false
-NoOverwrite
If specified, file will not be overwritten if it exists.
Required? false
Position? named
Default value false
Accept pipeline input? false
Accept wildcard characters? false
-Append
If specified, file will be appended to. Ignored if Offset is specified.
Required? false
Position? named
Default value false
Accept pipeline input? false
Accept wildcard characters? false
-AppendLine
If specified, file will be appended to on a new line. Ignored if Offset
is specified.
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-NoTruncate
If specified, file will not be truncated before being written to. Ignor
ed if non-zero Offset if specified.
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Controller <NaController>
The DataONTAP controller object, embodied by an NaController object. Th
is parameter is returned by the Connect-NaController cmdlet. If not spe
cified, the value in the global variable CurrentNaController is used.
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Offset <Int64>
Offset into file at which to start writing.
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-WarningAction <ActionPreference>
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-WarningVariable <String>
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-RawData <Byte[]>
Data to be written. The data is not interpreted but is written directly
to the file.
Required? true
Position? named
Default value
Accept pipeline input? true (ByValue, ByPropertyName)
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer and OutVariable. For more information, type,
"get-help about_commonparameters".
INPUTS
OUTPUTS
NOTES
Category: file
API: file-write-file
-------------- Example 1 --------------
C:\PS>Write-NaFile /vol/vol0/etc/hosts -AppendLine "10.10.10.10`tserver1"
Add a line to /etc/hosts.
RELATED LINKS
Read-NaFile
| Copyright © 2010 NetApp. All rights reserved. Use is subject to license terms. |
|
Data ONTAP® PowerShell Toolkit
|