@@ -54,6 +54,14 @@ xComputer resource has following properties:
5454* CurrentOU: A read-only property that specifies the organizational unit that
5555 the computer account is currently in
5656
57+ ### xComputer Examples
58+
59+ [ Set the Name and the Workgroup Name] ( 1-RnameComputerAndSetWorkgroup.ps1 )
60+ [ Switch from a Workgroup to a Domain] ( 2-JoinDomain.ps1 )
61+ [ Set the Name while staying on the Domain] ( 3-RenameComputerInDomain.ps1 )
62+ [ Set the Name while staying on the Workgroup] ( 4-RnameComputerInWorkgroup.ps1 )
63+ [ Switch from a Domain to a Workgroup] ( 5-UnjoinDomainAndJoinWorkgroup.ps1 )
64+
5765## xOfflineDomainJoin
5866
5967xOfflineDomainJoin resource is a [ Single Instance] ( https://msdn.microsoft.com/en-us/powershell/dsc/singleinstance )
@@ -62,6 +70,10 @@ resource that can only be used once in a configuration and has following propert
6270* IsSingleInstance: Must be set to 'Yes'. Required.
6371* RequestFile: The full path to the Offline Domain Join request file. Required.
6472
73+ ### xOfflineDomainJoin Examples
74+
75+ [ Join a Domain using an ODJ Request File] ( 1-JoinDomainUsingODJBlob.ps1 )
76+
6577## xScheduledTask
6678
6779xScheduledTask resource is used to define basic recurring scheduled tasks on the
@@ -151,6 +163,11 @@ xScheduledTask has the following properties:
151163 NetworkName parameter that you specify in this cmdlet to determine if the
152164 network is available.
153165
166+ ### xScheduledTask Examples
167+
168+ [ Create five different scheduled tasks that run PowerShell] ( 1-CreateScheduledTasks.ps1 )
169+ [ Run a PowerShell script every 15 minutes on a server] ( 2-RunPowerShellTaskEvery15Minutes.ps1 )
170+
154171## xPowerPlan
155172
156173xPowerPlan resource has following properties:
@@ -159,6 +176,10 @@ xPowerPlan resource has following properties:
159176 be 'Yes'.
160177* Name: The name of the power plan to activate.
161178
179+ ### xPowerPlan Examples
180+
181+ [ Sets Active Power Plan to the High Performance plan] ( 1-SetPowerPlan.ps1 )
182+
162183## xVirtualMemory
163184
164185xVirtualMemory resource is used to set the properties of the paging file on the
@@ -173,6 +194,10 @@ xVirtualMemory has the following properties:
173194* MaximumSize: The maximum size in MB of the paging file. Ignored for Type
174195 "AutoManagePagingFile" and "SystemManagedSize"
175196
197+ ### xVirtualMemory Examples
198+
199+ [ Set Page File to be 2GB on C Drive] ( 1-SetVirtualMemory.ps1 )
200+
176201## Versions
177202
178203### Unreleased
@@ -262,256 +287,3 @@ xVirtualMemory has the following properties:
262287
263288* Initial release with the following resources:
264289 * xComputer
265-
266- ## Examples
267-
268- ### Set the Name and the Workgroup Name
269-
270- This configuration will set the computer name to 'Server01'
271- and make it part of 'ContosoWorkgroup' Workgroup.
272-
273- ``` powershell
274- Configuration Example
275- {
276- param
277- (
278- [Parameter()]
279- [System.String[]]
280- $NodeName = 'localhost'
281- )
282-
283- Import-DscResource -Module xComputerManagement
284-
285- Node $NodeName
286- {
287- xComputer NewNameAndWorkgroup
288- {
289- Name = 'Server01'
290- WorkGroupName = 'ContosoWorkgroup'
291- }
292- }
293- }
294- ```
295-
296- ### Switch from a Workgroup to a Domain
297-
298- This configuration sets the machine name to 'Server01' and
299- joins the 'Contoso' domain.
300- Note: this requires an AD credential to join the domain.
301-
302- ``` powershell
303- Configuration Example
304- {
305- param
306- (
307- [Parameter()]
308- [System.String[]]
309- $NodeName = 'localhost',
310-
311- [Parameter(Mandatory = $true)]
312- [ValidateNotNullorEmpty()]
313- [System.Management.Automation.PSCredential]
314- $Credential
315- )
316-
317- Import-DscResource -Module xComputerManagement
318-
319- Node $NodeName
320- {
321- xComputer JoinDomain
322- {
323- Name = 'Server01'
324- DomainName = 'Contoso'
325- Credential = $Credential # Credential to join to domain
326- }
327- }
328- }
329- ```
330-
331- ### Set the Name while staying on the Domain
332-
333- This example will set the machines name 'Server01' while remaining
334- joined to the current domain.
335- Note: this requires a credential for renaming the machine on the
336- domain.
337-
338- ``` powershell
339- Configuration Example
340- {
341- param
342- (
343- [Parameter()]
344- [System.String[]]
345- $NodeName = 'localhost',
346-
347- [Parameter(Mandatory = $true)]
348- [ValidateNotNullorEmpty()]
349- [System.Management.Automation.PSCredential]
350- $Credential
351- )
352-
353- Import-DscResource -Module xComputerManagement
354-
355- Node $NodeName
356- {
357- xComputer NewName
358- {
359- Name = 'Server01'
360- Credential = $Credential # Domain credential
361- }
362- }
363- }
364- ```
365-
366- ### Set the Name while staying on the Workgroup
367-
368- This example will set the machine name to 'Server01' while remaining
369- in the workgroup.
370-
371- ``` powershell
372- Configuration Example
373- {
374- param
375- (
376- [Parameter()]
377- [System.String[]]
378- $NodeName = 'localhost'
379- )
380-
381- Import-DscResource -Module xComputerManagement
382-
383- Node $NodeName
384- {
385- xComputer NewName
386- {
387- Name = 'Server01'
388- }
389- }
390- }
391- ```
392-
393- ### Switch from a Domain to a Workgroup
394-
395- This example switches the computer 'Server01' from a domain and joins it
396- to the 'ContosoWorkgroup' Workgroup.
397- Note: this requires a credential.
398-
399- ``` powershell
400- Configuration Example
401- {
402- param
403- (
404- [Parameter()]
405- [System.String[]]
406- $NodeName = 'localhost',
407-
408- [Parameter(Mandatory = $true)]
409- [ValidateNotNullorEmpty()]
410- [System.Management.Automation.PSCredential]
411- $Credential
412- )
413-
414- Import-DscResource -Module xComputerManagement
415-
416- Node $NodeName
417- {
418- xComputer JoinWorkgroup
419- {
420- Name = 'Server01'
421- WorkGroupName = 'ContosoWorkgroup'
422- Credential = $Credential # Credential to unjoin from domain
423- }
424- }
425- }
426- ```
427-
428- ### Join a Domain using an ODJ Request File
429-
430- This example will join the computer to a domain using the ODJ
431- request file C:\ODJ\ODJRequest.txt.
432-
433- ``` powershell
434- configuration Example
435- {
436- param
437- (
438- [Parameter()]
439- [System.String[]]
440- $NodeName = 'localhost'
441- )
442-
443- Import-DscResource -ModuleName xComputerManagement
444-
445- Node $NodeName
446- {
447- xOfflineDomainJoin ODJ
448- {
449- RequestFile = 'C:\ODJ\ODJBlob.txt'
450- IsSingleInstance = 'Yes'
451- }
452- }
453- }
454- ```
455-
456- ### Run a PowerShell script every 15 minutes on a server
457-
458- This example will create a scheduled task that will call PowerShell.exe every 15
459- minutes to run a script saved locally.
460- The script will be called as the local system account
461-
462- ``` powershell
463- Configuration Example
464- {
465- param
466- (
467- [Parameter()]
468- [System.String[]]
469- $NodeName = 'localhost'
470- )
471-
472- Import-DscResource -ModuleName xComputerManagement
473-
474- Node $NodeName
475- {
476- xScheduledTask MaintenanceScriptExample
477- {
478- TaskName = "Custom maintenance tasks"
479- ActionExecutable = "C:\windows\system32\WindowsPowerShell\v1.0\powershell.exe"
480- ActionArguments = "-File `"C:\scripts\my custom script.ps1`""
481- ScheduleType = 'Once'
482- RepeatInterval = [datetime]::Today.AddMinutes(15)
483- RepetitionDuration = [datetime]::Today.AddHours(10)
484- }
485- }
486- }
487- ```
488-
489- ### Set Page File to be 2GB on C Drive
490-
491- Example script that sets the paging file to reside on
492- drive C with the custom size 2048MB
493-
494- ``` powershell
495- Configuration Example
496- {
497- param
498- (
499- [Parameter()]
500- [System.String[]]
501- $NodeName = 'localhost'
502- )
503-
504- Import-DSCResource -ModuleName xComputerManagement
505-
506- Node $NodeName
507- {
508- xVirtualMemory pagingSettings
509- {
510- Type = 'CustomSize'
511- Drive = 'C'
512- InitialSize = '2048'
513- MaximumSize = '2048'
514- }
515- }
516- }
517- ```
0 commit comments