Posted in Virtual Machine Manager, Windows Powershell | No Comment | 11,072 views | 14/04/2009 22:58
You can’t find this any other website because I wrote it :) Please leave a comment if it works for you.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
| Add-PSSnapin -name Microsoft.SystemCenter.VirtualMachineManager
Get-Vmmserver localhost
# VM Status Script - Yusuf Ozturk
# http://www.yusufozturk.info
$VMProp = Get-VM | Select-Object -Property Name,Status
foreach ($i in $VMProp)
{
$VMName = $i.Name
$VMStatus = $i.Status
$contentStatus = ' <status>' + $VMStatus + '</status>'
clear-content -path "C:\Program Files\Microsoft System Center Virtual Machine Manager 2008\wwwroot\Status\$VMName.xml"
add-content -path "C:\Program Files\Microsoft System Center Virtual Machine Manager 2008\wwwroot\Status\$VMName.xml" -value '<?xml version="1.0"?>'
add-content -path "C:\Program Files\Microsoft System Center Virtual Machine Manager 2008\wwwroot\Status\$VMName.xml" -value '<serverSettings>'
add-content -path "C:\Program Files\Microsoft System Center Virtual Machine Manager 2008\wwwroot\Status\$VMName.xml" -value $contentStatus
add-content -path "C:\Program Files\Microsoft System Center Virtual Machine Manager 2008\wwwroot\Status\$VMName.xml" -value '</serverSettings>'
} |
Add-PSSnapin -name Microsoft.SystemCenter.VirtualMachineManager
Get-Vmmserver localhost
# VM Status Script - Yusuf Ozturk
# http://www.yusufozturk.info
$VMProp = Get-VM | Select-Object -Property Name,Status
foreach ($i in $VMProp)
{
$VMName = $i.Name
$VMStatus = $i.Status
$contentStatus = ' <status>' + $VMStatus + '</status>'
clear-content -path "C:\Program Files\Microsoft System Center Virtual Machine Manager 2008\wwwroot\Status\$VMName.xml"
add-content -path "C:\Program Files\Microsoft System Center Virtual Machine Manager 2008\wwwroot\Status\$VMName.xml" -value '<?xml version="1.0"?>'
add-content -path "C:\Program Files\Microsoft System Center Virtual Machine Manager 2008\wwwroot\Status\$VMName.xml" -value '<serverSettings>'
add-content -path "C:\Program Files\Microsoft System Center Virtual Machine Manager 2008\wwwroot\Status\$VMName.xml" -value $contentStatus
add-content -path "C:\Program Files\Microsoft System Center Virtual Machine Manager 2008\wwwroot\Status\$VMName.xml" -value '</serverSettings>'
}
You could run this as cronjob. You can see status in http://scvmm.domain.com/status/$vmname.xml.
Posted in Virtual Machine Manager | 1 Comment | 7,952 views | 13/04/2009 10:59
You may get this warning on SCVMM panel. Sometimes that can cause to stop your virtual machine:
Warning (2903)
VMM could not locate the specified file C:\Users\Administrator\Desktop\web.iso on the hyperv03.contoso.fabrikam.com server. This file might be required as part of another object.
(The system cannot find the file specified (0x80070002))
Recommended Action
Ensure that you have specified a valid path parameter, and that all necessary files are present. Try the operation again.
You have to go Hyper-V management console and edit virtual machine settings. If you disable iso file from ide devices, that warning will be fixed.
Posted in Virtual Machine Manager | No Comment | 5,025 views | 12/04/2009 18:24
When changing owner of a virtual machine, you can get this error from SCVMM:
Error (11427)
The ownership for this virtual machine cannot be changed because the new owner is not a member of a user role that has access to this virtual machine.
Recommended Action
Either change the new owner to a user who has access to this virtual machine, or contact your Virtual Machine Manager administrator to request access for the user you want to own this virtual machine and then try the operation again.
Solution is simple. You have to create an user role for your user account. You can find “User Role” tab in Administration.
Posted in Virtual Machine Manager | No Comment | 4,123 views | 12/04/2009 18:11
Probably, you have same vm name in your host groups.
Error (802)
The VM file SERVER20 is already in use by another VM.
Recommended Action
Wait for the object to become available, and then try the operation again.
Solution? Give another name to your new virtaul machine..
Posted in Virtual Machine Manager, Windows Server | No Comment | 2,643 views | 12/04/2009 16:07
Hyper-v sunucusunu farklı bir active directory’e sokmanız halinde, user SID’leri değişeceği için Hyper-v sunucularını yönetememe gibi bir sorunla karşılaşabilirsiniz. Bu nedenle makinaların XML’lerine girerek,
<sid>XXX-XXXX-XXXX-XXXX</sid>
olan yerlerdeki SID numaralarını değiştirmeniz gerekiyor. Yeni SID’lerin ne olduğunu bilmiyorsanız, yeni bir virtual machine yaratarak, yeni XML’den SID çekebilirsiniz. Kolay gelsin.
Posted in Hosting & IIS7, Windows Server | No Comment | 3,200 views | 12/04/2009 15:58
You can install all iis7 components with Servermanagercmd command on command prompt.
1
| ServerManagerCmd -install Web-Server -a |
ServerManagerCmd -install Web-Server -a
Also you can use other way, pkgmgr:
1
| start /w pkgmgr /iu:IIS-WebServerRole;IIS-WebServer;IIS-CommonHttpFeatures;IIS-StaticContent;IIS-DefaultDocument;IIS-DirectoryBrowsing;IIS-HttpErrors;IIS-HttpRedirect;IIS-ApplicationDevelopment;IIS-ASPNET;IIS-NetFxExtensibility;IIS-ASP;IIS-CGI;IIS-ISAPIExtensions;IIS-ISAPIFilter;IIS-ServerSideIncludes;IIS-HealthAndDiagnostics;IIS-HttpLogging;IIS-LoggingLibraries;IIS-RequestMonitor;IIS-HttpTracing;IIS-CustomLogging;IIS-ODBCLogging;IIS-Security;IIS-BasicAuthentication;IIS-WindowsAuthentication;IIS-DigestAuthentication;IIS-ClientCertificateMappingAuthentication;IIS-IISCertificateMappingAuthentication;IIS-URLAuthorization;IIS-RequestFiltering;IIS-IPSecurity;IIS-Performance;IIS-HttpCompressionStatic;IIS-HttpCompressionDynamic;IIS-WebServerManagementTools;IIS-WebServerManagementTools;IIS-ManagementConsole;IIS-ManagementScriptingTools;IIS-ManagementService;IIS-IIS6ManagementCompatibility;IIS-Metabase;IIS-WMICompatibility;IIS-LegacyScripts;IIS-LegacySnapIn;IIS-FTPPublishingService;IIS-FTPServer;IIS-FTPManagement;WAS-WindowsActivationService;WAS-ProcessModel;WAS-NetFxEnvironment;WAS-ConfigurationAPI |
start /w pkgmgr /iu:IIS-WebServerRole;IIS-WebServer;IIS-CommonHttpFeatures;IIS-StaticContent;IIS-DefaultDocument;IIS-DirectoryBrowsing;IIS-HttpErrors;IIS-HttpRedirect;IIS-ApplicationDevelopment;IIS-ASPNET;IIS-NetFxExtensibility;IIS-ASP;IIS-CGI;IIS-ISAPIExtensions;IIS-ISAPIFilter;IIS-ServerSideIncludes;IIS-HealthAndDiagnostics;IIS-HttpLogging;IIS-LoggingLibraries;IIS-RequestMonitor;IIS-HttpTracing;IIS-CustomLogging;IIS-ODBCLogging;IIS-Security;IIS-BasicAuthentication;IIS-WindowsAuthentication;IIS-DigestAuthentication;IIS-ClientCertificateMappingAuthentication;IIS-IISCertificateMappingAuthentication;IIS-URLAuthorization;IIS-RequestFiltering;IIS-IPSecurity;IIS-Performance;IIS-HttpCompressionStatic;IIS-HttpCompressionDynamic;IIS-WebServerManagementTools;IIS-WebServerManagementTools;IIS-ManagementConsole;IIS-ManagementScriptingTools;IIS-ManagementService;IIS-IIS6ManagementCompatibility;IIS-Metabase;IIS-WMICompatibility;IIS-LegacyScripts;IIS-LegacySnapIn;IIS-FTPPublishingService;IIS-FTPServer;IIS-FTPManagement;WAS-WindowsActivationService;WAS-ProcessModel;WAS-NetFxEnvironment;WAS-ConfigurationAPI
Choosing Servermanagercmd is a clever choise, i think.
Posted in Windows Powershell, Windows Server | No Comment | 8,032 views | 10/04/2009 19:25
You can parse CIDR on Powershell with this script:
1
2
3
4
5
6
7
8
9
10
11
12
13
| $IPAddress = “192.168.1.1/24”
$address = ($IpAddress.split("/")[0])
$cidr = ([int]($IpAddress.split("/")[1]))
$netid = [System.Net.IPAddress]("$address");
$bits = $netid.GetAddressBytes()
$ip1=$bits[0]
$ip2=$bits[1]
$ip3=$bits[2]
$ip4=$bits[3]+1
$Gateway = $address
$IPAddress1 = "$ip1.$ip2.$ip3.$ip4"
write-Output $Gateway
write-Output $IPAddress1 |
$IPAddress = “192.168.1.1/24”
$address = ($IpAddress.split("/")[0])
$cidr = ([int]($IpAddress.split("/")[1]))
$netid = [System.Net.IPAddress]("$address");
$bits = $netid.GetAddressBytes()
$ip1=$bits[0]
$ip2=$bits[1]
$ip3=$bits[2]
$ip4=$bits[3]+1
$Gateway = $address
$IPAddress1 = "$ip1.$ip2.$ip3.$ip4"
write-Output $Gateway
write-Output $IPAddress1
You can use if/else statement for $cidr.
|