"format-table" command which is conflicting with the default formatting



  • 1. error running script
    Hi All, I am install Activeroles management Shell for Active Directory. I am trying to run following script: Function Get-SPInventory { PROCESS { $wmi = Get-WmiObject Win32_OperatingSystem omp $_.Name | Select CSName,BuildNumber,ServicePackMajorVersion $obj = New-Object PSObject $obj | Add-Member NoteProperty BuildNumber ($wmi.BuildNumber) $obj | Add-Member NoteProperty CSName ($wmi.CSName) $obj | Add-Member NoteProperty SPVersion ($wmi.ServicePackMajorVersion) $wmi = Get-WmiObject Win32_BIOS omp $_.Name | Select SerialNumber $obj | Add-Member NoteProperty BIOSSerial ($wmi.SerialNumber) Write-Output $obj } } Get-Content c:\computernames.txt | Get-SPInventory #end script I am receiving error message: Get-WmiObject : Cannot validate argument because it is null. At C:\WINDOWS\system32\WindowsPowerShell\v1.0\Inventory4.ps1:5 char:53 + $wmi = Get-WmiObject Win32_OperatingSystem -comp <<<< $_.Name | Select CSName,BuildNum n cmdlet Add-Member at command pipeline position 1 Supply values for the following parameters: Name: What is wrong ?
  • 2. ADSI attributes Case Sensitve
    Hi all, I've noticed that ADSI attributes returned from a search are lowercase and must be referenced as such. Take for example: $sr = [adsi] $DomainRootADsPath $dso = new-object System.DirectoryServices.DirectorySearcher $dso.SearchRoot = $sr $dso.pagesize = 100 $dso.searchscope = "subtree" [Void]$dso.PropertiesToLoad.add("displayName") <-- this can be mixed case $dso.Filter = "(&(objectcategory=person)(info=*Vendor*))" $rs = $dso.findall() Write-Host $rs.count "Vendor accounts found." $rs | foreach { $sADList.Add([string]$_.properties.displayname, $null) <-- displayname here must be referenced in lowercase. } Is this the way it is or am I missing something? Thanks
  • 3. Gnu argp or getopt like arguments processor for Powershell?
    Is there anything like the Gnu 'argp' or 'getopt' parsers from glibc for processing command line arguments to a PS function? In particular the self documenting --usage and --help screens would be a real help and I just wanted to check that there wasn't already something out there before looking into it. Many thanks, Duncan
  • 4. Free Disk Space
    I haven't used Powershell before and I am new to scripting. I need to run a scrip to report available free disk space on 20 plus Servers. Is this possible with Powershell and how hard is it to create? Thank you in advance

"format-table" command which is conflicting with the default formatting

Postby Norbert Kraft » Fri, 05 Jan 2007 18:15:01 GMT

Hi ,
I have made a short script  NoPLMAccess.ps1 ,  which should list all 
directories on a specific shre, that do not have aceesstrings where the 
domainname occurs.

ndr user filesystem \myserver\myshare

Get-Item user:* |
|Get-Acl | Where-object {-not ($_.accesstostring -like "*MyDomain*") } |
format-table PSchildname,accesstostring -AutoSize -wrap

The funny thing is, it works, when you type in these commands directly into 
the Powershell console, if you invoke the script, however, by
an error
out-lineoutput : Object of type 
"Microsoft.PowerShell.Commands.Internal.Format.FormatStartData" is not legal 
or not in
the correct sequence. This is likely caused by a user-specified 
"format-table" command which is conflicting with the de
fault formatting. is the result.
if you source the script
. .\NoPLMAccess
the script works and format processing is done as requested.

Is there any explanation for that ?

Similar Threads:

1...."format-table command conflicting with the default formatting"...

This is a script I wrote to give me the time until next year...

[console]::title = "Next Year Count Down"

$NextYearDate = get-date "1/1/2010"
$NextYearDate - ([datetime]::now)

while (1)
 Write-Host "Time until Next Year: "
 write-host ""
 $NextYearDate - ([datetime]::now) | select days, hours, minutes, seconds | 
ft -autosize
 $NextYearDate - ([datetime]::now) | select totaldays, totalhours, 
totalminutes, totalseconds| ft -autosize
 sleep 1

It fails when run from a script, but succeeds when cut and pasted into the 
console. Ideas? 

2.-f format Format-Table Format-List against Select

For some reason I need to rename a column within a select

Get-WmiObject win32_SystemEnclosure -ComputerName SD-IT003
it returns SerialNumber

But I do not like this label, I want to rename it

Get-WmiObject win32_SystemEnclosure -ComputerName $p | ft @{Expression=
--> This works really well, but instead of renaming the column in FT,
I need to rename it during a select

So I tried this:

Get-WmiObject win32_SystemEnclosure -ComputerName $p | select @
{Expression={$_.SerialNumber};Label="SN"} | ft *

but it returns
Select-Object : Illegal key Label
At line:1 char:61
+ Get-WmiObject win32_SystemEnclosure -ComputerName $p| select  <<<< @

Why is that ? is there a way to fix it ?

3.[MSH] format-table formatting hashtable bug

4.Convert from MS 2003 Word TABLE to EXCEL Format to .CSV Formatted File


I am working with a table within a MS WORD 2003 document.  I want to
ultimately generate a .CSV file based from the tabular data. 

I have been told that the data must first be placed within an EXCEL
spreadsheet before exporting/saving as a .CSV file format.  

What is the best way to proceed ?

Thank you.

Regards, de Vince

5.[demo] Format-Chart - Formats output as a table with a chart colum

6. "Format-Table -autosize" as default

7. Under Win XP Pro SP2 Need to Format Floppy with DOS Command Format A:/S

8. formatting command syntax like get-help or get-command

Return to powershell


Who is online

Users browsing this forum: No registered users and 47 guest