expand power-shell script knowledge

Hi I want to expand my power-shell knowledge:
I have created this user-friendly script,
#import
Add-PsSnapin Microsoft.SharePoint.PowerShell
$spWeb=Read-Host "Enter site: "
$web=Get-Spsite $spWeb
$path = Read-Host "Enter Path: "
Import-SPWeb $spWeb -Path $path -UpdateVersions Overwrite
Write-Host "Imported successfully"

I feel if I add below queries in this script will be good, Please help

example:-

1.How to write call function to this script, 
2.if function is ok then success mesaage should shown or else shown failed 
3.if function is successful message should shown like do u want to export (Y/N), if Yes then call export function..etc..
if you add extra stuff in this script i would be more happy...Thank You

August 25th, 2015 12:29am

What is your question?  We cannot design and build custom scripts for you.  You need to ask a question.

Start here: https://technet.microsoft.com/en-us/scriptcenter/dd793612.aspx?f=255&MSPPError=-2147217396

Free Windows Admin Tool Kit Click here and download it now
August 25th, 2015 2:21am

Hi

You might start with how to call/ use a function in the powershell:

http://blogs.technet.com/b/heyscriptingguy/archive/2010/08/09/how-do-i-use-a-windows-powershell-script-containing-functions.aspx

http://www.jonathanmedd.net/2015/01/how-to-make-use-of-functions-in-powershell.html

Hope it helps.

Best Regards,

Elaine

September 9th, 2015 2:58am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics