VMware Cloud Community
ajohn24
Contributor
Contributor
Jump to solution

Automating scratch partition

Hi Luc,

I was following one of your posts on how to automate the scratch partition. But it does not seem to work for me. Attached is the code.

The script just runs, and ask to disconnect from the server but does not configure anything. It actually disconnects twice if you see the output below:

cmdlet Get-Credential at command pipeline position 1
Supply values for the following parameters:
Credential
Please enter the credentials to login to the server abc.com

IsConnected   : True
Id            : /VIServer=root@abc.com:443/
ServiceUri    : https://abc.com/sdk
SessionSecret : 524c0c91-297b-d974-aeee-a63d0add4c8c
Name          : abc.com
Port          : 443
SessionId     : 524c0c91-297b-d974-aeee-a63d0add4c8c
User          : root
Uid           : /VIServer=root@abc.com:443/
Version       : 5.1
Build         : 1483097
ProductLine   : embeddedEsx
InstanceUuid  :
RefCount      : 2
ExtensionData : VMware.Vim.ServiceInstance


Confirm
Are you sure you want to perform this action?
Performing operation "Disconnect VIServer" on Target "User: root, Server: abc.com, Port: 443".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"):
Please enter the credentials to login to the server abc.com

IsConnected   : True
Id            : /VIServer=root@abc.com:443/
ServiceUri    : https://abc.com/sdk
SessionSecret : 524c0c91-297b-d974-aeee-a63d0add4c8c
Name          : abc.com
Port          : 443
SessionId     : 524c0c91-297b-d974-aeee-a63d0add4c8c
User          : root
Uid           : /VIServer=root@abc.com:443/
Version       : 5.1
Build         : 1483097
ProductLine   : embeddedEsx
InstanceUuid  :
RefCount      : 2
ExtensionData : VMware.Vim.ServiceInstance


Confirm
Are you sure you want to perform this action?
Performing operation "Disconnect VIServer" on Target "User: root, Server: abc.com, Port: 443".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"):
Disconnecting from the server vc.com..

Please suggest.

Thx,

AJ

Reply
0 Kudos
22 Replies
LucD
Leadership
Leadership
Jump to solution

Isn't there any output from that last version of the script you attached ?

If yes, can you attach it here ?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
ajohn24
Contributor
Contributor
Jump to solution

Hi Luc,

So, somehow when I ran this script this time it ran without any issues and configured the scratch partition. Nothing changed sine the last time in the environment so not sure how. To verify it, I deleted the .locker-* directory from the datastore and re-ran the script but it's not configuring it now and am getting the same issue again. I have attached the output in the text file. Do we need to reboot the host or something?

Also is there a way we can change the location of the path back to where we were running the script from. As you see below it changes to vmstores:

PowerCLI vmstores:\vc.com@443\DC-Farm\abc_local_datastoreI

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

To remember the location you can do the following (I only show the relevant part).

if($ds){

    Push-Location

    Set-Location -Path $ds.DatastoreBrowserPath

    New-Item $tgtName -ItemType directory

    Pop-Location

    Set-VMHostAdvancedConfiguration -Name $configName -Value ('/vmfs/volumes/' + $ds.Name + '/' + $tgtName) -Server $esxi -Confirm:$false

Afaik, a reboot of the ESXi is required to activate the change


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos