Thursday, February 23, 2012
Cosonok's IT Blog: Citrix Udadmin Delete Script & Event 1163
Monday, February 20, 2012
Thursday, February 16, 2012
Wednesday, February 15, 2012
PowerShell Script for Exporting a virtual machine
Even though it might be tempting just to copy a whole virtual machine from Hyper-V Host to Hyper-V Host, this is not the way to do it. Importing and Exporting Hyper-V-style is. This post provides a PowerShell script to make it easier.
I need to automate the process of exporting a virtual machine recently – and when I checked around I found that while there are a number of sample scripts out there that show you how to do this (some even on this blog) they are all written in VBScript. As I am now to the stage where PowerShell is my preferred scripting language – I sat down and wrote up this short script:
# Function for handling WMI jobs / return values
Function ProcessResult($result, $successString, $failureString)
{
#Return success if the return value is "0"
if ($result.ReturnValue -eq 0)
{write-host $successString}
#If the return value is not "0" or "4096" then the operation failed
ElseIf ($result.ReturnValue -ne 4096)
{write-host $failureString " Error value:" $result.ReturnValue}
Else
{#Get the job object
$job=[WMI]$result.job
#Provide updates if the jobstate is "3" (starting) or "4" (running)
while ($job.JobState -eq 3 -or $job.JobState -eq 4)
{write-host $job.PercentComplete "% complete"
start-sleep 1
#Refresh the job object
$job=[WMI]$result.job}
#A jobstate of "7" means success
if ($job.JobState -eq 7)
{write-host $successString
return $true}
Else
{write-host $failureString
write-host "ErrorCode:" $job.ErrorCode
write-host "ErrorDescription" $job.ErrorDescription
return $false}
}
}
# Prompt for the Hyper-V Server to use
$HyperVServer = Read-Host "Specify the Hyper-V Server to use (enter '.' for the local computer)"
# Prompt for the virtual machine to use
$VMName = Read-Host "Specify the name of the virtual machine"
# Prompt for the path to export to
$ExportPath = Read-Host "Specify the path to place the exported virtual in"
# Get the management service
$VMMS = gwmi -namespace root\virtualization Msvm_VirtualSystemManagementService -computername $HyperVServer
# Get the virtual machine object
$VM = gwmi MSVM_ComputerSystem -filter "ElementName='$VMName'" -namespace "root\virtualization" -computername $HyperVServer
# Export the virtual machine
$result = $VMMS.ExportVirtualSystem($VM, $true, $ExportPath)
# Check to make sure we succeeded
$exportSucceeded = ProcessResult $result "Virtual machine exported." "Failed to export virtual machine."
Some quick notes to make about this script:
- This script takes a Hyper-V server name, a virtual machine name and an export path – and then performs a full export to the requested location.
- I am using the older (deprecated) ExportVirtualSystem method here – and not ExportVirtualSystemEx (which I really should do). The main reason for this is that while ExportVirtualSystemEx is a lot more powerful than ExportVirtualSystem, ExportVirtualSystem works perfectly fine for this basic use case and is much easier to script.
Source and download: http://blogs.msdn.com/b/virtual_pc_guy/archive/2012/02/08/powershell-script-for-exporting-a-virtual-machine.aspx
Similar Posts:
- Installing print drivers and migrating the logical printers on Terminal Server
- VMMUpdate: Free MS SCVMM update script
- How to put a VM on Azure
- The VDI Read/Write Ratio Challenge
- Setting Up Failover Clustering for Hyper-V
FREE Tool: NTFS Permissions Reporter – What are the NTFS permissions?
NTFS Permissions Reporter is a new tool from Cjwdev, with a completely free edition available for anyone to download and use without any registration or time limits imposed. It makes auditing and reviewing permissions on your file system quick and easy.
you can simply right click on any directory in Windows Explorer and choose Report Permissions to launch the program and instantly see how permissions are assigned to that directory and all of its sub directories.
What are the NTFS permissions? NTFS Permissions Reporter
The report results can be viewed in either tree format (which mimics the explorer style view of directories that we are all used to) or in a sortable table format. Different levels of permissions are highlighted in different colours to make it easy to see at a glance what level of access a particular user or group has to a directory.
Source and download: http://4sysops.com/archives/free-ntfs-permissions-reporter-what-are-the-ntfs-permissions/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+4sysops+%284sysops%29
Similar Posts:
- PhoneFactor – Free Mobile phone based two-factor authentication
- How to defrag a Hyper-V R2 Cluster Shared Volume
- Adding Shell Extensions to App-V Packages
- VMware ThinApp 4.6.2
- Use Powershell to analyze your Windows Profiles
Thursday, February 9, 2012
Tuesday, February 7, 2012
ThinKiosk - Turn Your Old Hardware into a Windows Thin Device for Free!
ThinKiosk - Turn Your Old Hardware into a Windows Thin Device for Free!: During all my VDI roll-outs, at the end of building the infrastructure and training the customer with client deployment techniques, there is always the question on how to make create the best endpoint experience for the user. There are several different ways of course, depending on what functionality the end user needs. But, in regards to your basic task worker, where all they need is a connection to their virtual desktop, and they want to utilize their current endpoint devices, I usually would recommend a home brew solution that I created. My solution involved setting up Internet Explorer in kiosk mode and setting that to the user interface instead of explorer.exe and a list of registry/group policy modifications that limits what the end user can do on their endpoint and give them access to their virtual desktop. My solution was OK at best for customers who wanted a free solution and did not want to go the Linux route as this had several disadvantages as well.
Now, some very smart person named Andrew Morgan created an application that is meant to replace the default shell explorer.exe This new shell brings the user straight to the Citrix Web Interface for login to access their virtual desktop. The reasons why I am very impressed with this shell:
- Session and power state control
- Restart
- Shutdown
- Log off
- User session options
- Display settings
- Keyboard settings
- Mouse settings
- Volume settings
- Administrator options
- Created a new VM to gain a better vantage of a typical customer aging endpoint device:
- Windows XP x86
- 512MB RAM
- 10GB hard drive
- After I logged into the VM for the first time, I installed the following:
- Internet Explorer 8
- Adobe Flash Player
- Citrix Receiver
- ThinKiosk
- Create a user and set that user to auto login:
- In a command prompt type "Control userpasswords2"
- Complete the autologin configuration
- I then modified the shell for the auto login user account to point to ThinKiosk.exe:
- Navigate to HKCU\Software\Microsoft\WindowsNT\CurrentVersion\Winlogon
- Created a new string named "Shell"
- Set the data value to "C:\Program Files\ThinKiosk\ThinKiosk.exe"
- You can also set this through Group Policy - http://technet.microsoft.com/en-us/library/cc975911.aspx
- Created the following registry keys (you can create these through Group Policy preferences):
- Create the following key: HKCU\Software\ThinKiosk
- Create the following values:
- Name = "URL"
- Type = REG_SZ
- Value = the URL to your Citrix Web Interface
- Name = "SHOWADMINMENU"
- Type = REG_DWORD
- Value = 1 or 0
- Name = "SHOWLOGOFF"
- Type = REG_DWORD
- Value = 1 or 0
- Name = "WINDOWMODE"
- Type = REG_DWORD
- Value = 1 or 0
- Name = "WINDOWMODEPERCENT"
- Type = REG_SZ
- Value = 1 or 0
- The above settings can also be made through group policy, in which there is an ADM file that you can download from the ThinKiosk site
- Configure the following group policy settings:
- Local Computer Policy\User Configuration\Administrative Templates\System\Ctrl+Alt+Del Options
- Remove change password - Enabled
- Remote lock computer - Enabled
- Remote task manager - Enabled