PowerShell script exchange
Post Reply
Amerloc
Influencer
Posts: 12
Liked: 1 time
Joined: Mar 08, 2012 9:26 am
Full Name: Adolfo Alvarez
Contact:

Can't set the StgBlockSize option on a just created job

Post by Amerloc »

I create a new job via Powershell script and the next step is to load job options in a variable called $jobopt and then setting the $jobopt.Options.RootNode.StgBlockSize = "KbBlockSize512". But when this command runs, the following error appears:
"Property 'StgBlockSize' cannot be found on this object; make sure it exists and is settable
At C:\creabackup.ps1:15 char:26
+ $jobopt.Options.RootNode. <<<< StgBlockSize = "KbBlockSize512"
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyAssignmentException"

If I type $jobopt.Options.RootNode, all I get is this:

Name : JobOptionsRoot
LocalName : JobOptionsRoot
NamespaceURI :
Prefix :
NodeType : Element
ParentNode : #document
OwnerDocument : #document
IsEmpty : True
Attributes : {}
HasAttributes : False
SchemaInfo : System.Xml.XmlName
InnerXml :
InnerText :
NextSibling :
PreviousSibling :
Value :
ChildNodes : {}
FirstChild :
LastChild :
HasChildNodes : False
IsReadOnly : False
OuterXml : <JobOptionsRoot />
BaseURI :

Seems like the xml field related to job options is not populated.

If I go to the GUI, edit job's properties and click finish, then I can set the StgBlockSize option via powershell using the previous command.
¿Is there a way to do the same that is done when I edit the job and click finish via powershell?

Thanks.
tsightler
VP, Product Management
Posts: 6035
Liked: 2860 times
Joined: Jun 05, 2009 12:57 pm
Full Name: Tom Sightler
Contact:

Re: Can't set the StgBlockSize option on a just created job

Post by tsightler » 1 person likes this post

Code: Select all

$jobopt.BackupStorageOptions.StgBlockSize = "KbBlockSize512"
Amerloc
Influencer
Posts: 12
Liked: 1 time
Joined: Mar 08, 2012 9:26 am
Full Name: Adolfo Alvarez
Contact:

Re: Can't set the StgBlockSize option on a just created job

Post by Amerloc »

Thanks a lot tsightler. Too many hours working :-)
Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests