I have multiple folders with space in the folder name, and need to replace the space with underscore.
Found a simple batch file to do that
From this:
To this:
Script:
@ECHO OFF
SETLOCAL ENABLEDELAYEDEXPANSION
FOR /D %%d IN (*) DO (
SET "NAME=%%d"
SET "NEWNAME=!NAME: =_!"
IF NOT "!NAME!"=="!NEWNAME!" rename "!NAME!" "!NEWNAME!"
)
pause
exit
Showing posts with label howto. Show all posts
Showing posts with label howto. Show all posts
Thursday, November 9, 2017
Replace "space" with"underscore" in folder name - recursively
Tuesday, April 22, 2014
Get esx host for each vm using powercli
Here's a one liner to get the hostname of the vm is currently running on.
PowerCLI C:\cq> get-vm <VM-NAME> | select Name, @{N="Cluster";E={get-cluster -vm $_ }}, @{N="ESX Host";E={get-vmhost -VM $_}}
replace the VM-NAME with your VM.
for multiple VM, use comma (,)
eg:
get-vm vm01, vm02, vm03 | select Name, @{N="Cluster";E={get-cluster -vm $_ }}, @{N="ESX Host";E={get-vmhost -VM $_}}
PowerCLI C:\cq> get-vm <VM-NAME> | select Name, @{N="Cluster";E={get-cluster -vm $_ }}, @{N="ESX Host";E={get-vmhost -VM $_}}
replace the VM-NAME with your VM.
for multiple VM, use comma (,)
eg:
get-vm vm01, vm02, vm03 | select Name, @{N="Cluster";E={get-cluster -vm $_ }}, @{N="ESX Host";E={get-vmhost -VM $_}}
Monday, July 8, 2013
Disk drive is write protected, Unable to create file with File system error (65535)
Some simptoms:
Unable to create file with File system error (65535)
Whenever I try to create new file in my one of my system drives it is displaying "Unable to create file xxxx.txt". File system error(65535) Previously I was able to create/delete files.
Now every thing related to file operations are getting failed (create/delete/modify).
For file modify following error message is displayed "The drive cannot fine sector requested".
Second hard drive says write-protected
I've got a new 2008 enterprise terminal server. I've installed all my apps to the 2nd hard drive. Now for no reason, I can't write to the drive and my apps can't either as they all crash as soon as they need to.
I get this exact error when simply trying to create a directory in the root of the drive:
"The disk is write-protected.
Remove the write-protection or use another disk."
I'm logging in as the local admin, domain admin makes no diff. I've also given full permissions to "everyone" with no luck. How the heck can I fix this bugger?
Unable to create file with File system error (65535)
Whenever I try to create new file in my one of my system drives it is displaying "Unable to create file xxxx.txt". File system error(65535) Previously I was able to create/delete files.
Now every thing related to file operations are getting failed (create/delete/modify).
For file modify following error message is displayed "The drive cannot fine sector requested".
Second hard drive says write-protected
I've got a new 2008 enterprise terminal server. I've installed all my apps to the 2nd hard drive. Now for no reason, I can't write to the drive and my apps can't either as they all crash as soon as they need to.
I get this exact error when simply trying to create a directory in the root of the drive:
"The disk is write-protected.
Remove the write-protection or use another disk."
I'm logging in as the local admin, domain admin makes no diff. I've also given full permissions to "everyone" with no luck. How the heck can I fix this bugger?
Solution:
It could be that the ReadOnly flag is on, do the following
on cmd prompt launch "diskpart.exe"
on the diskpart prompt, do the following
This will give you a list of all disks in your system
Note down the number of your problem disk, then do the folloiwng
Where x is the number of your problem disk, then do the following
This will list all the details of your problem disk
Check if the ReadOnly flag is set to Yes
If the ReadOnly flag is set to Yes, do the follwing
This should clear the flag on the disk, please retry your disk operations
If ths does not solve it, we have another flag on the volume, same command, but now on volume:
on cmd prompt launch "diskpart.exe"
on the diskpart prompt, do the following
| LIST DISK |
This will give you a list of all disks in your system
Note down the number of your problem disk, then do the folloiwng
| SELECT DISK x |
Where x is the number of your problem disk, then do the following
| DETAIL DISK |
This will list all the details of your problem disk
Check if the ReadOnly flag is set to Yes
If the ReadOnly flag is set to Yes, do the follwing
| ATTR DISK CLEAR READONLY |
This should clear the flag on the disk, please retry your disk operations
If ths does not solve it, we have another flag on the volume, same command, but now on volume:
| LIST VOLUME |
| SELECT VOLUME x |
| DETAIL VOLUME |
| ATTR VOLUME CLEAR READONLY |
Wednesday, July 3, 2013
How to remove ESXi from domain (AD)
This is how to leave a domain for ESX server (for whatever reason you have).
1) Put the ESX in maintenance mode
2) Go to Configuration > Authentication Services
3) click on Properties
4) On the Domain Settings, click button Leave Domain
5) Exit maintenance mode
on the error event "Leave Windows Domain: The operation is not allow in the current state", try to reboot the ESX and repeat the steps. In my case, it helps.
PowerCLI command to see which ESX is still authenticated to AD:-
Get-VMHost | sort | Get-VMHostAuthentication | select vmhost,domain,DomainMembershipStatus,TrustedDomains | ft -a
1) Put the ESX in maintenance mode
2) Go to Configuration > Authentication Services
3) click on Properties
4) On the Domain Settings, click button Leave Domain
5) Exit maintenance mode
on the error event "Leave Windows Domain: The operation is not allow in the current state", try to reboot the ESX and repeat the steps. In my case, it helps.
PowerCLI command to see which ESX is still authenticated to AD:-
Get-VMHost | sort | Get-VMHostAuthentication | select vmhost,domain,DomainMembershipStatus,TrustedDomains | ft -a
Subscribe to:
Posts (Atom)

