"format-table" command which is conflicting with the default formatting
by 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
.\NoPLMAccess
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)
{
cls
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
so
Get-WmiObject win32_SystemEnclosure -ComputerName $p | ft @{Expression=
{$_.SerialNumber};Label="SN"}
--> 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 <<<< @
{Expression={$_.SerialNumber};Label="SN"}
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
Hello:
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