Remko Weijnen's Blog (Remko's Blog)

About Virtualization, VDI, SBC, Application Compatibility and anything else I feel like

Archive for the ‘PowerShell’ Category

For an upcoming Blog post I needed to convert a Byte Array to a Hex string in PowerShell and vice versa.

PowerShell doesn’t come with HexToBin or BinToHex functions so here’s my attempt at it:

(more…)

  • 1 Comment
  • Filed under: PowerShell
  • Parse RES Building Blocks with PowerShell

    Background
    Customer uses Citrix XenApp 5 with ThinApp, RES Workspace Manager and RES Workspace Extender.

    An application integration strategy is defined, the picture below displays the strategy and preferred order:

    image

    Question
    Customer wanted to know the type (1..7) for all applications currently defined in RES Workspace Manager.

    I decided to export all the Applications from RES WM as Building Blocks. This results in a folder with XML files. I decided to parse the XML files with a PowerShell script.

    (more…)

    A customer had partially implemented a (written) policy in the past where the the Local Administrator account was renamed according to a special convention.

    This policy stated that the Administrator account needed to be renamed to admin with the computername as a prefix.

    However they didn’t know exactly on which machines this policy had been applied to in the past. I was asked to write a script that would check a list of machine names, query the Administrator account name and write this in a new list.

    The Administrator account has a Well Known SID of S-1-5-21-xxxxxxx-500 where xxxxxxx is the SID of the computer.

    (more…)

    After joining a new Windows 2008 R2 Server to the domain I could not login to the domain.

    I would get the following error message:

    The security database on the server does not have a computer acocunt for this workstation trust relationship.

    Additionally the following error was logged in the Eventlog:

    Event ID 3 | Error 1787 | Error Code 0x7 | KDC_ERR_S_PRINCIPAL_UNKNOWN | A Kerberos Message was received

     

    (more…)

    My Network Places Internals

    Nethood IconI am using a PowerShell script to copy some elements of from the users old profile location to a new location. This includes the Nethood ("My Network Places") folder which contains the Network Places shortcuts.

    A user reported that she could not save documents to Network Places anymore and after inspection the Network Places shortcuts were broken.

    I started comparing the old Nethood folder to the new and observed the following difference in Explorer:

    image

    When copying entries from the Nethood folder with Explorer manually they worked fine, so somehow Explorer gives the Nethood folder special treatment.

    (more…)

    Bit Shifting in PowerShell

    I needed to dome some Bit Shifting in PowerShell but unfortunately PowerShell lacks operator for Bit Shifting. I searched the .NET Framework for anything that allows for bit shifting but was unable to find anything suitable.

    I didn’t want to revert to C# so I implemented shift left and shift right functions in PowerShell.

    The code isn’t really pretty and could probably be improved (comments/improvements are welcome!) but here goes (please note that I implemented for bit shifting a byte):

    (more…)

    Create Active Directory Group with PowerShell

    If you want to Create an Active Directory group with PowerShell there are a few things you need to be aware of:

    First of all there is no direct way to create new objects in Active Directory. You always need to bind to the Domain or an Organizational Unit and call the Create method.

    Example:

    However the group is not yet complete:

    Group name (pre-Windows 2000)

    (more…)

    When Launching a PowerShell script I noticed the following error: “AuthorizationManager check failed.

    AuthorizationManager check failed.| At line:1 char:2 | Microsoft.PowerShell_profile.ps1'

    This happens because either the Current User or the All Users PowerShell profile is empty.

    (more…)

    Today I was troubleshooting a message that appeared when a user tries to edit a document from SharePoint on a Citrix XenApp server.

    The user browsed to a word document on Sharepoint and selected “Edit in Microsoft Office Word” from the Combobox:

    Edit in Microsoft Office Word

    This would present the following error message to the user:

    'Edit Document' requires a Windows SharePoint Services-compatible application and Microsoft Internet Explorer 6.0 or greater.

    (more…)

    From a script I needed to schedule a project in RES Automation Manager 2011 for a particular server.

    imageThis can be done with the WMC.exe commandline tool as documented in the Admin Guide. However we must specify the agent’s GUID instead of it’s name. We can of course use the AM console to get the agent’s GUID but it’s more flexible to script this.

    imageUnfortunately there’s no API we can call so I am directly quering the AM database using a PowerShell script.

    The script read the database server and database name from the registry so it assumes you have the AM console installed.

    (more…)

    Donate


    Blogroll


    Categories


    Archives