Advertisement
Guest User

Untitled

a guest
Jan 15th, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # powershell.exe -ExecutionPolicy Bypass -File \\stcasia\root\Public\Lab\Image\partition.ps1
  2. # Resize System partition
  3. $SizeMax = ( Get-PartitionSupportedSize -DriveLetter C ).SizeMax
  4.  
  5. if ( ( Get-Partition -DriveLetter C ).Size -ne $SizeMax )
  6. {
  7.     Resize-Partition -DriveLetter C -Size $SizeMax
  8. }
  9.  
  10. # Remove CD-ROM drive letter
  11. $Volume = Get-WmiObject -Class Win32_Volume | Where-Object {
  12.     ( $_.DriveLetter -eq 'E:' ) -and ( $_.Drivetype -eq 5 )
  13. }
  14.  
  15. if ( $Volume -ne $null )
  16. {
  17.     $Volume.DriveLetter = $null
  18.     $Volume.put()
  19. }
  20.  
  21. # Initialize the RAW data disk and create new partition
  22. Get-Disk | Where-Object PartitionStyle -EQ RAW | Initialize-Disk -PartitionStyle MBR -PassThru | `
  23.     New-Partition -AssignDriveLetter -UseMaximumSize | Format-Volume -FileSystem NTFS -Confirm:$false
  24.  
  25. # Allow ICMP Echo Request
  26. netsh.exe firewall set icmpsetting 8
  27.  
  28. # Enable PSRemoting
  29. Enable-PSRemoting -Force
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement