R
R
Rick2016-01-16 22:45:18
PowerShell
Rick, 2016-01-16 22:45:18

How to make a script in PowerShell?

Hello! On the PC there is a shared folder "shared". I make a backup using PowerShell. Using the following technology
Add-Pssnapin Windows.ServerBackup
$policy=New-WBPolicy
$backupFolders=New-WBFileSpec -FileSpec c:\music, c:\books
Add-$WBFileSpec -Policy $policy -FileSpec $backupFolders
$BackupTargetVolume=New-WBBackupTarget -VolumePath E:
Add-WBBackupTarget -Policy $policy -Target $BackupTargetVolume
Start-WBBackup -Policy $policy
Everything is fine. The backup is being done.
But here the task is to make a script and put it in the scheduler.
Before that, I did not work with PowerShell. You need to quickly create a script.
Who can direct where to dig, or links to man I will be very grateful.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Eugene, 2016-01-16
@rick1211

if it's simple:
1. save your file in text form with the ps1 extension 2.
put it in a known place
3. then see point 2 of MrDywar Pichugin's answer and create a task that executes your script the script execution policy can also be specified when creating a task in the task scheduler via the -ExecutionPolicy key)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question