PowerShell
827 subscribers
214 photos
4 videos
1 file
802 links
Task automation and configuration management framework #PowerShell
Download Telegram
Today's cmdlet ‣ Restart-Service
Stops and then starts one or more services.

Example's Remarks:
• This command starts all of the stopped network services on the computer.

#tutorial
Today's cmdlet ‣ Get-WinEvent
Gets events from event logs and event tracing log files on local and remote computers.

Example's Remarks:
• The `Get-WinEvent` cmdlet uses the LogName parameter to specify the Windows PowerShell event log.
• The event objects are stored in the `$Event` variable.
• The Count property of `$Event`shows the total number of logged events.

#tutorial
Today's cmdlet ‣ Format-Custom
Uses a customized view to format the output.

Example's Remarks:
• This command formats information about the `Start-Transcript` cmdlet in the format defined by the MyView view, a custom view created by the user.
• To run this command successfully, you must first create a new PS1XML file, define the MyView view, and then use the `Update-FormatData` command to add the PS1XML file to PowerShell.

#tutorial
Today's cmdlet ‣ ConvertFrom-StringData
Converts a string containing one or more key and value pairs to a hash table.

Example's Remarks:
• Because the text includes variable names, it must be enclosed in a single-quoted string so that the variables are interpreted literally and not expanded.
• Variables are not permitted in the DATA section.

#tutorial
👍1
Today's cmdlet ‣ Copy-Item
Copies an item from one location to another.

Example's Remarks:
• Unlike the `Copy-Item`, the Filter parameter for `Get-ChildItem` applies to the items discovered during recursion.
• This enables you to find, filter, and then copy items recursively.

#tutorial
👍3
Today's cmdlet ‣ Split-Path
Returns the specified part of a path.

Example's Remarks:
• This command changes your location to the folder that contains the PowerShell profile.

#tutorial
1
Today's cmdlet ‣ Export-PSSession
Exports commands from another session and saves them in a PowerShell module.

Example's Remarks:
• The `New-PSSession` command creates a PSSession on the Server01 computer and saves it in the `$S` variable.
• The `Export-PSSession` command exports the cmdlets whose names begin with Test from the PSSession in `$S` to the TestCmdlets module on the local computer.

#tutorial
Today's cmdlet ‣ Resume-Service
Resumes one or more suspended (paused) services.

Example's Remarks:
• This command resumes all of the suspended services on the computer.
• The `Get-Service` cmdlet command gets all of the services on the computer.
• The pipeline operator (`|`) passes the results to the `Where-Object` cmdlet, which selects the services that have a Status property of Paused.
• The next pipeline operator sends the results to `Resume-Service`, which resumes the paused services.

#tutorial
👍1
Today's cmdlet ‣ Get-Date
Gets the current date and time.

Example's Remarks:
• A variable, `$DST` stores the result of `Get-Date`.
• `$DST` uses the IsDaylightSavingTime method to test if the date is adjusted for daylight savings time.

#tutorial
Today's cmdlet ‣ Debug-Process
Debugs one or more processes running on the local computer.

Example's Remarks:
• This command attaches a debugger to all processes that have names that begin with SQL.

#tutorial