Skip to content

Commit f40b56f

Browse files
authored
Merge pull request MicrosoftDocs#8867 from MicrosoftDocs/chrisda
Updates to write commands with "-Encoding Byte"
2 parents 8eddcb7 + 50a1efc commit f40b56f

11 files changed

+27
-23
lines changed

exchange/exchange-ps/exchange/Export-DlpPolicyCollection.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ You need to be assigned permissions before you can run this cmdlet. Although thi
3737

3838
### Example 1
3939
```powershell
40-
$file = Export-DlpPolicyCollection
41-
Set-Content -Path "C:\My Documents\Contoso PII.xml" -Value $file.FileData -Encoding Byte
40+
$DlpPol = Export-DlpPolicyCollection
41+
[System.IO.File]::WriteAllBytes('C:\My Documents\Contoso PII.xml', $DlpPol.FileData)
4242
```
4343

4444
This example exports all the elements of the existing DLP policies to the file C:\\My Documents\\Contoso PII.xml.

exchange/exchange-ps/exchange/Export-JournalRuleCollection.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,18 @@ You need to be assigned permissions before you can run this cmdlet. Although thi
3939
### Example 1
4040
```powershell
4141
$file = Export-JournalRuleCollection
42-
Set-Content -Path "C:\MyDocs\JournalRules.xml" -Value $file.FileData -Encoding Byte
42+
[System.IO.File]::WriteAllBytes('C:\MyDocs\JournalRules.xml', $file.FileData)
4343
```
4444

4545
This example exports journal rules in a two-step process. In the first step, the Export-JournalRuleCollection cmdlet exports journal rules to the variable $file. In the second step, the Set-Content cmdlet saves the exported data to the XML file JournalRules.xml.
4646

4747
### Example 2
4848
```powershell
4949
$file = Export-JournalRuleCollection -ExportLegacyRules
50-
Set-Content -Path "C:\MyDocs\Ex2007-JournalRules.xml" -Value $file.FileData -Encoding Byte
50+
[System.IO.File]::WriteAllBytes('C:\MyDocs\LegacyJournalRules.xml', $file.FileData)
5151
```
5252

53-
In Exchange Server 2010, this example exports legacy journal rules to an XML file using the two-step process similar to the preceding example. In the first step, the Export-JournalRuleCollection cmdlet is used with the ExportLegacyRules switch to export legacy rules to the array $file. In the second step, the exported data is saved to the XML file Ex2007-JournallRules.xml.
53+
In Exchange Server 2010, this example exports legacy journal rules that were created in Exchange 2007 to an XML file. The first command uses the ExportLegacyRules switch to export legacy journal rules to the variable named $file. The second step saves the exported data to the XML file named LegacyJournalRules.xml.
5454

5555
## PARAMETERS
5656

exchange/exchange-ps/exchange/Export-RecipientDataProperty.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,16 @@ You need to be assigned permissions before you can run this cmdlet. Although thi
4747

4848
### Example 1
4949
```powershell
50-
Export-RecipientDataProperty -Identity [email protected] -SpokenName | ForEach { $_.FileData | Add-Content C:\tonysmith.wma -Encoding Byte}
50+
$SN = Export-RecipientDataProperty -Identity [email protected] -SpokenName
51+
[System.IO.File]::WriteAllBytes('C:\tonysmith.wma', $SN.FileData)
5152
```
5253

5354
This example exports Tony Smith's spoken name audio file and saves it to the local computer.
5455

5556
### Example 2
5657
```powershell
57-
Export-RecipientDataProperty -Identity "Ayla" -Picture | ForEach { $_.FileData | Add-Content C:\aylakol.jpg -Encoding Byte}
58+
$Pic = Export-RecipientDataProperty -Identity "Ayla Kol" -Picture
59+
[System.IO.File]::WriteAllBytes('C:\Data\aylakol.jpg', $Pic.FileData)
5860
```
5961

6062
This example exports Ayla Kol's picture file to the local computer.

exchange/exchange-ps/exchange/Export-TransportRuleCollection.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,20 +42,22 @@ You need to be assigned permissions before you can run this cmdlet. Although thi
4242
### Example 1
4343
```powershell
4444
$file = Export-TransportRuleCollection
45-
Set-Content -Path "C:\My Docs\Rules.xml" -Value $file.FileData -Encoding Byte
45+
[System.IO.File]::WriteAllBytes('C:\My Docs\Rules.xml', $file.FileData)
4646
```
4747

4848
This example exports transport rules. Rule data is first exported to the variable $file, and then written to the XML file Rules.xml in the C:\\My Docs folder.
4949

50-
**Note**: In PowerShell 6.0 or later, replace `-Encoding Byte` with `-AsByteStream`.
51-
5250
### Example 2
5351
```powershell
5452
$file = Export-TransportRuleCollection -ExportLegacyRules
55-
Set-Content -Path "C:\MyDocs\LegacyRules.xml" -Value $file.FileData -Encoding Byte
53+
[System.IO.File]::WriteAllBytes('C:\My Docs\LegacyRules.xml', $file.FileData)
5654
```
5755

58-
In Exchange Server 2010, this example exports legacy transport rules created in Exchange 2007 using the ExportLegacyRules switch. The cmdlet should be run from an Exchange 2010 Hub Transport server. The exported rules collection can then be imported to Exchange 2010 using the Import-TransportRuleCollection cmdlet.
56+
In Exchange Server 2010, this example exports legacy transport rules that were created in Exchange 2007 to an XML file. The first command uses the ExportLegacyRules switch to export legacy transport rules to the variable named $file. The second step saves the exported data to the XML file named LegacyRules.xml.
57+
58+
You can import the exported rules collection to Exchange 2010 using the Import-TransportRuleCollection cmdlet.
59+
60+
You need to run these commands in this example on an Exchange 2010 Hub Transport server.
5961

6062
## PARAMETERS
6163

exchange/exchange-ps/exchange/Export-UMPrompt.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,15 @@ You need to be assigned permissions before you can run this cmdlet. Although thi
5050
### Example 1
5151
```powershell
5252
$prompt = Export-UMPrompt -PromptFileName "customgreeting.mp3" -UMDialPlan MyUMDialPlan
53-
Set-Content -Path "d:\DialPlanPrompts\welcomegreeting.mp3" -Value $prompt.AudioData -Encoding Byte
53+
[System.IO.File]::WriteAllBytes('D:\DialPlanPrompts\welcomegreeting.mp3', $prompt.AudioData)
5454
```
5555

5656
This example exports the welcome greeting for the UM dial plan MyUMDialPlan and saves it as the file welcomegreeting.mp3.
5757

5858
### Example 2
5959
```powershell
6060
$prompt = Export-UMPrompt -PromptFileName "welcomegreeting.mp3" -UMAutoAttendant MyUMAutoAttendant
61-
Set-Content -Path "e:\UMPromptsBackup\welcomegreetingbackup.mp3" -Value $prompt.AudioData -Encoding Byte
61+
[System.IO.File]::WriteAllBytes('E:\UMPromptsBackup\welcomegreetingbackup.mp3', $prompt.AudioData)
6262
```
6363

6464
This example exports a custom greeting for the UM auto attendant MyUMAutoAttendant and saves it to the file welcomegreetingbackup.mp3.

exchange/exchange-ps/exchange/New-DataClassification.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ You need to be assigned permissions before you can run this cmdlet. Although thi
4141

4242
### Example 1
4343
```powershell
44-
$Employee_Template = Get-Content "C:\My Documents\Contoso Employee Template.docx" -Encoding byte
44+
$Employee_Template = [System.IO.File]::ReadAllBytes('C:\My Documents\Contoso Employee Template.docx')
4545
$Employee_Fingerprint = New-Fingerprint -FileData $Employee_Template -Description "Contoso Employee Template"
46-
$Customer_Template = Get-Content "D:\Data\Contoso Customer Template.docx" -Encoding byte
46+
$Customer_Template = [System.IO.File]::ReadAllBytes('D:\Data\Contoso Customer Template.docx')
4747
$Customer_Fingerprint = New-Fingerprint -FileData $Customer_Template -Description "Contoso Customer Template"
4848
New-DataClassification -Name "Contoso Employee-Customer Confidential" -Fingerprints $Employee_Fingerprint,$Customer_Fingerprint -Description "Message contains Contoso employee or customer information."
4949
```

exchange/exchange-ps/exchange/New-OMEConfiguration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ You need to be assigned permissions before you can run this cmdlet. Although thi
4747

4848
### Example 1
4949
```powershell
50-
New-OMEConfiguration -Identity "Contoso Marketing" -EmailText "Encrypted message enclosed." -PortalText "This portal is encrypted." -DisclaimerText "Encryption security disclaimer." -Image (Get-Content "C:\Temp\OME Logo.gif" -Encoding byte)
50+
New-OMEConfiguration -Identity "Contoso Marketing" -EmailText "Encrypted message enclosed." -PortalText "This portal is encrypted." -DisclaimerText "Encryption security disclaimer." -Image ([System.IO.File]::ReadAllBytes('C:\Temp\OME Logo.gif'))
5151
```
5252

5353
This example creates a new OME configuration named "Contoso Marketing" with the specified values specified. Unused parameters get the default values.

exchange/exchange-ps/exchange/New-PublicFolderMigrationRequest.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ You need to be assigned permissions before you can run this cmdlet. Although thi
5555

5656
### Example 1
5757
```powershell
58-
New-PublicFolderMigrationRequest -SourceDatabase PFDB01 -CSVData (Get-Content C:\PFMigration\CSVData.csv -Encoding Byte)
58+
New-PublicFolderMigrationRequest -SourceDatabase PFDB01 -CSVData ([System.IO.File]::ReadAllBytes('C:\PFMigration\CSVData.csv'))
5959
```
6060

6161
This example creates a public folder migration request from the Exchange 2010 source public folder database PFDB01 and uses the CSVData.csv file that was created using the Export-PublicFolderStatistics.ps1 script. For more information, see [Use serial migration to migrate public folders to Exchange 2013 from previous versions](https://docs.microsoft.com/previous-versions/exchange-server/exchange-150/jj150486(v=exchg.150)).

exchange/exchange-ps/exchange/Set-DataClassification.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ This example removes the existing Spanish translation from the data classificati
5858

5959
### Example 3
6060
```powershell
61-
$Benefits_Template = Get-Content "C:\My Documents\Contoso Benefits Template.docx" -Encoding byte
61+
$Benefits_Template = [System.IO.File]::ReadAllBytes('C:\My Documents\Contoso Benefits Template.docx')
6262
$Benefits_Fingerprint = New-Fingerprint -FileData $Benefits_Template -Description "Contoso Benefits Template"
6363
$Contoso_Confidential = Get-DataClassification "Contoso Confidential"
6464
$Array = [System.Collections.ArrayList]($Contoso_Confidential.Fingerprints)

exchange/exchange-ps/exchange/Set-OMEConfiguration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ You need to be assigned permissions before you can run this cmdlet. Although thi
4747

4848
### Example 1
4949
```powershell
50-
Set-OMEConfiguration -Identity "OME Configuration" -EmailText "Encrypted message enclosed." -PortalText "This portal is encrypted." -DisclaimerText "Encryption security disclaimer." -Image (Get-Content "C:\Temp\OME Logo.gif" -Encoding byte)
50+
Set-OMEConfiguration -Identity "OME Configuration" -EmailText "Encrypted message enclosed." -PortalText "This portal is encrypted." -DisclaimerText "Encryption security disclaimer." -Image ([System.IO.File]::ReadAllBytes('C:\Temp\OME Logo.gif'))
5151
```
5252

5353
This example configures the specified values for the default OME configuration named "OME Configuration". Note the use of the Get-Content command to provide the input for the Image parameter.

exchange/exchange-ps/exchange/Test-SystemHealth.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,11 @@ This example gathers data about your Exchange system.
6060

6161
### Example 2
6262
```powershell
63-
$temp=Test-SystemHealth -OutData
64-
Set-Content -Value $temp.FileData -Path d:\temp\SystemHealthOutData.xml -Encoding Byte
63+
$SysHealth = Test-SystemHealth -OutData
64+
[System.IO.File]::WriteAllBytes('D:\temp\SystemHealthOutData.xml', $SysHealth.FileData)
6565
```
6666

67-
This example saves the output data as a byte stream to the temporary variable $temp. Then the content is written to the file SystemHealthOutData.xml using the Set-Content cmdlet.
67+
This example saves the output data as a byte stream to the variable named $SysHealth. The content is then written to the SystemHealthOutData.xml file in the D:\\temp folder.
6868

6969
## PARAMETERS
7070

0 commit comments

Comments
 (0)