Matt Bloomfield

Forum Replies Created

Viewing 15 posts - 346 through 360 (of 429 total)
  • Author
    Posts
  • in reply to: VmWare and Powershell multi-valued attributes #34225
    Participant
    Topics: 4
    Replies: 429
    Points: 770
    Helping Hand
    Rank: Major Contributor

    Please can you give some sample data for $luns and the output you would like in the CSV. It’s hard to answer the question without knowing specifically what data you have and what you want the CSV file to look like.

    If you’re just looking to get a multivalued property or array in a single cell then I think you’re working along the right lines using the join method. Here’s a quick example with Win32_LogicalDisk

    in reply to: ConvertTo-HTML does not preserve single column heading #34100
    Participant
    Topics: 4
    Replies: 429
    Points: 770
    Helping Hand
    Rank: Major Contributor

    According to a cursory search, this behaviour has been around for a while. I can’t see a bug report for it on user voice though.

    The bug only rears its head if you pipe Select-Object to Convertto-HTML. You can have a single column if you use the -property parameter:

    in reply to: Measure Home directory – Descending #34078
    Participant
    Topics: 4
    Replies: 429
    Points: 770
    Helping Hand
    Rank: Major Contributor

    I took the same approach as the other Matt.

    Participant
    Topics: 4
    Replies: 429
    Points: 770
    Helping Hand
    Rank: Major Contributor

    I don’t get that error so perhaps the file you’ve saved is not the save as the script that you have posted.

    There’s a fair bit wrong with the script:

    $countsource = @(Get-Item-Path $source "\\Servername\C$\davesdata")<br />$countdest = @(Get-Item-Path $dest "\\Servername\C$")

    Your path is determined when you call the script with the source and dest parameters. You have no choice but to specify them as they are both mandatory parameters. There’s no need to put the paths in quote marks after the variable names. Just specifying $source and $dest is enough. You also need a space between the cmdlet name Get-Item and the parameter -path.

    IF($countsource = $countdest){

    This is a common error. The equals sign is the assignment operator in PowerShell. That means that what you’re attempting to do is assign $countdest to $countsource.

    To compare objects for equality you need to use the -eq operator.

    Finally, and most importantly, the comparison you’re trying to make will always return false so your script, even if you make the corrections I suggest above, won’t work as intended.

    in reply to: Set up PS remoting on home edition #33962
    Participant
    Topics: 4
    Replies: 429
    Points: 770
    Helping Hand
    Rank: Major Contributor

    You’ll also find more information in the free PowerShell.org book Secrets of PowerShell Remoting.

    Something you may wish to consider doing is getting hold of a free hypervisor such as VirtualBox or VMware player and then downloading an evaluation version of Windows server. It doesn’t take an awful lot of resources to run a couple of virtual machines and you’ll be able to set up an Active Directory domain.

    in reply to: Get-Mailbox and Get-MailboxFolderPermission #33675
    Participant
    Topics: 4
    Replies: 429
    Points: 770
    Helping Hand
    Rank: Major Contributor

    I’m not sure what you’re asking. Do you just want to know what’s happening when you run the command you posted or are you having a problem with the command?

    in reply to: Reading XML attribute value using PowerShell #33674
    Participant
    Topics: 4
    Replies: 429
    Points: 770
    Helping Hand
    Rank: Major Contributor

    Please post the web config file on Gist and paste a link to it here so that we can take a look.

    Participant
    Topics: 4
    Replies: 429
    Points: 770
    Helping Hand
    Rank: Major Contributor

    Have a look at Listdlls by Mark Russinovich. It’s available on SysInternals.

    You will need to know the process name or pid of regasm.exe. Here’s an example for notepad which runs as notepad.exe

    Note, that’s not the full list of dlls, I just posted a few to give you an idea of the output.

    in reply to: Multi-Value Parameter Defaults #33637
    Participant
    Topics: 4
    Replies: 429
    Points: 770
    Helping Hand
    Rank: Major Contributor

    Try it like this:

    [string[]]$DNSServers = @('1.1.1.1','2.2.2.2')

    The @() is called the array operator and is used to create an array of objects. Your parameter definition accepts an array of strings as denoted by the [].

    in reply to: Powershell + WSUS + searching for updates #33635
    Participant
    Topics: 4
    Replies: 429
    Points: 770
    Helping Hand
    Rank: Major Contributor

    I can’t test it but from MSDN it looks like an empty collection is returned if no updates are found MSDN – SearchUpdates Method.

    The UpdateCollection object has a Count property so you may be able to use
    if ($kbs.count -eq 0) {...} to test for an empty collection.

    in reply to: Unable to export mail ID's from security group #33151
    Participant
    Topics: 4
    Replies: 429
    Points: 770
    Helping Hand
    Rank: Major Contributor

    From testing here, I don’t think get Get-ADGroupMember will work either. That command only returns groups, users and computers, and a contact object is a separate class of object. Try the Get-ADObject command with an LDAP filter on the group’s DN. You can use the ResultSetSize parameter to ensure all objects are returned.

    in reply to: Windows 10 Storage Space Two Drives Retired #33146
    Participant
    Topics: 4
    Replies: 429
    Points: 770
    Helping Hand
    Rank: Major Contributor

    Is this KB relevant to you? Issue 2 in particular:

    https://support.microsoft.com/en-us/kb/2842575

    in reply to: Ignoring warning/error popup messages for Excel script #33110
    Participant
    Topics: 4
    Replies: 429
    Points: 770
    Helping Hand
    Rank: Major Contributor

    Can you give us some idea of what the errors are and what the pop-ups say. I didn’t get any errors or pop-ups when testing this.

    in reply to: Excel com objects for refreshing data and saving as CSV #33088
    Participant
    Topics: 4
    Replies: 429
    Points: 770
    Helping Hand
    Rank: Major Contributor

    I missed the edit, sorry. You can check and remove a file with the same name using the following code.

    Insert it before the $wb.SaveAs("$newFile",6) line

    in reply to: Excel com objects for refreshing data and saving as CSV #33085
    Participant
    Topics: 4
    Replies: 429
    Points: 770
    Helping Hand
    Rank: Major Contributor

    My fault, I was running the script in the same folder as my test files. Replace $wb = $xl.Workbooks.Open($file) with $wb = $xl.Workbooks.Open($file.FullName).

Viewing 15 posts - 346 through 360 (of 429 total)