Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

storing the last letter of Hostname in a variable for later use

$
0
0

hi friends

i have some servers which their hostnames adhere "Myserver+number" naming convention .

for example their exact names are:

Myserver1 ,   Myserver2,   Myserver3

now i need a command that stores the last letter of the Hostname (which is definitely a digit), in a variable for later use.

i can get the computer name via  (gwmiwin32_computersystem).name

but i don't know the rest. i don't know how to use get-content or select-string or any other cmdlets to achieve that. i tried these cmdets but no result

any help?

thanks in advanced

 


Viewing all articles
Browse latest Browse all 6937

Trending Articles