Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Scheduling a powershell script - issues 1

Status
Not open for further replies.
Sep 20, 1999
3,824
US
Ok, I've been telling people that they should schedule an "ExportEdgeConfig.ps1" script to fire off every couple of weeks to capture changes to their environment and make sure that their edge is recoverable. But I can't get my script to work so far.

Here's what I've got right now:

Code:
powershell -PSConsoleFile "C:\Program Files\Microsoft\Exchange Server\bin\ExShell.psc1" -command ". 'C:\program files\Microsoft\Exchange Server\scripts\ExportEdgeConfig.ps1' '-CloneConfigdata:"C:\Edgedump.xml"'"

And here's my output:

C:\>powershell -PSConsoleFile "C:\Program Files\Microsoft\Exchange Server\bin\ExShell.psc1" -command ". 'C:\program files\Microsoft\Exchange Server\scripts\ExportEdgeConfig.ps1' '-CloneConfigdata:"C:\Edgedump.xml"'"Exporting Edge configuration information failed. Reason: Exception calling ".ctor" with "2" argument(s): "The given path's format is not supported."

Can anyone provide a working version?

Dave Shackelford
ThirdTier.net
 
Ok, I decided to create a workaround. Since my ultimate problem was passing the parameters, I decided to create my own version of the ExportEdgeConfig.ps1 script instead, one that had the path parameter hard-coded. If you want to do the same thing, look for the section of the script that looks like this:

Code:
#Usage 
#:: ./exportedgeconfig 
#-cloneConfigData:"C:\cloneConfigData.xml"

And insert this right after it:

Code:
$cloneConfigData = "C:\EdgeDump.xml"

Save that script under a new name. I called mine ExportEdgeDave.ps1. When it runs, it overwrites the existing file. I would like to be able to append the date to the script using another variable to set DaveDate to "get-date -format o" but after messing with it a while, I decided to keep it simple. If anyone else wants to offer a more elegant solution, I'm all ears.

Dave Shackelford
ThirdTier.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top