Powershell script Information output in column instead of rows
Dear All,
I am required powershell script Information output in column instead of rows.
$usr= get-aduser -filter * | select sAMAccountName,homeDrive,TerminalServicesProfilePath,homeDirectory,physicalDeliveryOfficeName,userAccountControl,displayName,l,mail, profilepath
$myarray = @()
Foreach($usr1 in $usr)
$userDN = (Get-ADUser $usr1.samaccountname).distinguishedName
$userInfo = [ADSI]"LDAP://$userDN" | select sAMAccountName,homeDrive,TerminalServicesProfilePath,homeDirectory,physicalDeliveryOfficeName,userAccountControl,displayName,l,mail, profilepath
$ts=$userInfo.TerminalServicesProfilePath
$sn=$userInfo.samaccountname
$hm=$userinfo.homeDrive
$hd=$userinfo.homeDirectory
$pd=$userinfo.physicalDeliveryOfficeName
$ua=$userinfo.userAccountControl
$dp=$userinfo.displayName
$ll=$userinfo.l
$ml=$userinfo.mail
$pp=$userinfo.profilepath
$myarray += New-Object psobject -Property @{
Sam = $userInfo.samaccountname
TerminalServicesProfilePath = $userInfo.TerminalServicesProfilePath
homeDrive = $userinfo.homeDrive
homeDirectory=$userinfo.homeDirectory
physicalDeliveryOfficeName=$userinfo.physicalDeliveryOfficeName
userAccountControl=$userinfo.userAccountControl
displayName=$userinfo.displayName
l=$userinfo.l
mail=$userinfo.mail
profilepath=$userinfo.profilepath
$myarray |fl
$myarray | Out-File "c:\final.txt"
Hey this is such a sweet small script compared to everything else out there and I guess you can edit it to return any value you wish. One LARGE problem however: the TerminalServicesProfilePath comes back empty on all accounts regardless of whether the field
is populated or not. This is basically because this setting is not stored in an Active Directory attribute but Terminal Services information is stored in the userParameters schema attribute as a BLOB.
I got this script:
$Users = ([ADSISearcher]"(&(objectCategory=person)(objectClass=user))").findall() | select path
foreach ($user in $users) {
$userSearch = [adsi]"$($user.path)"
# get logon name
$userSearch.psbase.InvokeGet(“SamAccountName”)
# Profile Attributes
$userSearch.psbase.InvokeGet("ProfilePath")
# Remote Desktop Services Attributes
$userSearch.psbase.InvokeGet("TerminalServicesProfilePath")
which returns the value but the output is terribly unformatted. If we could integrate the two to ensure that it is correctly formatted, AND returns the TSProfile that would be awesome!
Can anyone help me do that?
Life is dangerous, no one has ever survived. So enjoy!
Please do not tag an unrelated quesiton onto the end of an old and answered question. Please read the forum guidelines before posting.
We do not do custom scripts on demand.
¯\_(ツ)_/¯
Similar Messages
-
How to make the width of powershell script's output greater than 80 column?
Hi,
I am trying to remotely execute a powershell script through ssh, and I found the output of my script is only 80 width, a carriage-return and a line-feed are inserted after 79th column, and continue presenting the 80th value of each row onto another line.
I want it greater than 80, such as 512.
The code to print the output in my script is like:
$allInfo | ConvertTo-Xml -as Stream -NoTypeInformation -Depth 1
Any help will be really appreciated!But when I run the powershell script manually, I get the following error message, I do not know why, but anyway, my problem is resolved.
Exception setting "BufferSize": "Cannot set the buffer size because the size specified is too large or too small.
Parameter name: value
Actual value was 512,25."
At C:\Users\qzhang\Documents\GetVM.ps1:30 char:16
+ $Host.UI.RawUI. <<<< BufferSize = New-Object Management.Automation.Host.Size (512, 25)
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyAssignmentException
Yeah, that's a good question. I get the same thing here. The longer solution the post covers which I've included below does work interactively, and looking at the differences it appears to be related to the buffer height. My guess is when
the existing console window already has more rows in the buffer than the 25 rows in height the command tries to define, this error occurs.
if( $Host -and $Host.UI -and $Host.UI.RawUI ) {
$rawUI = $Host.UI.RawUI
$oldSize = $rawUI.BufferSize
$typeName = $oldSize.GetType( ).FullName
$newSize = New-Object $typeName (500, $oldSize.Height)
$rawUI.BufferSize = $newSize -
How to export Powershell script information to Sharepoint?
I'm trying to export information gather from a Powershell script to a Sharepoint list. I've got a couple of powershell scripts that gather general server information from a server ex: server uptime, disk space, service tag, etc. and it will export the information
to a csv file. What I would like to do is out-put the same information gathered by the powershell scripts to a Sharepoint list directly if at all possible.
Ex:
# all this does is reads from a list and runs a script call "boottime.ps1"
get-content "\\%Data-Path-Of-List%\computers.txt" | %Data-Path-Of-Script%\boottime.ps1 | Export-csv %Data-Path-For-CSV\Computers.csv
# then just exports the information from the boottime.ps1 script to a csv file
#I also have a script that will upload the information to a sharepoint list.
# I found that I have to run this in version 2 of powershell, so I just open a DOS prompt in Admin Priv's and type the following
powershell.exe -version 2.0
# Next I make sure the Sharepoint snap-in is loaded
if ( (Get-PSSnapin -Name Microsoft.sharepoint.powershell - erroraction silentlycontinue) -eq $null)
Add-PsSnapin Microsoft.Sharepoint.Powershell
$spweb = get-SPweb $spserver
$spdata =$spweb.getlist("%URL_Of_My_List%")
# this is the same location from the orginal Powershell script previously stated.
$ComputerInfoFile = "%Data-Path-For-CSV%\Computers.csv"
foreach ($rows in $tblData) {
# here is where I add the information from my csv file
# 2 things needs to be present
# 1st the colums have to be present in the sharepoint site before I can upload the information
# 2nd the columns have to the headers in my csv file
$spItem = $spData.AddItem()
$SpItem["ServerName"] = $row."ServerName".toString()
$SpItem["Uptime"] = $row."Uptime".toString()
$SpItem.Update()
# this just disconnects from Sharepoint
$spWeb.Dispose()
Please dismiss all the comments it just helps me understand what the code is doing, also if this is not the correct place to post this question I appologize in adavance and ask that if this is the incorrect place to post this question please provide me a
link to a where I can post such questions.Sorry for the delay in posting this, but I ended up getting working. I'll post it in the hopes that my head scratching will save someone else some head scratching:
I ended up writting 3 PS scripts and one batch job.
1st Batch file
powershell.exe -version 2.0 -command
\\%Script-Location\Get-Server-Infor-4-SP.ps1
powershell.exe -version 2.0 -command \\%Script-Location\Delete-list-Items.ps1"
powershell -veriosn 2.0 -command
\\%Script-Location\Populate-SP.ps1
1st PS script that gets the info:
get-content
\\%Location-Of-My-File-With-List-Of-Servers%\%name-of-file%.txt |
\\%Location-Of-My-Script-To-get-the-Information-I-want | Export-csv
\\%location-of-my-output\%filename%.csv
Ex: get-content C:\scripts\computers.txt | C:\scripts\boottime.ps1 | export-csv C:\scripts\computer.csv
2nd PS script Delete-List-Items.ps1
# http:
#Script 1 Boottime.ps1:
# This script permits to get UpTime from localHost or a set of remote Computer
# usage
# localHost
# .\BootTime.ps1
# set of remote computers
# get-content .\MyserverList.txt | .\boottime.ps1
# Optionally pipe output to Export-Csv, ConverTo-Html
Process {
$ServerName = $_
if ($serverName -eq $Null) {
$serverName= $env:COMPUTERNAME
$timeVal = (Get-WmiObject -ComputerName $ServerName -Query "SELECT LastBootUpTime FROM Win32_OperatingSystem").LastBootUpTime
#$timeVal
$DbPoint = [char]58
$Years = $timeVal.substring(0,4)
$Months = $timeVal.substring(4,2)
$Days = $timeVal.substring(6,2)
$Hours = $timeVal.substring(8,2)
$Mins = $timeVal.substring(10,2)
$Secondes = $timeVal.substring(12,2)
$dayDiff = New-TimeSpan $(Get-Date –month $Months -day $Days -year $Years -hour $Hours -minute $Mins -Second $Secondes) $(Get-Date)
$Info = "" | select ServerName, Uptime
$Info.servername = $servername
$d =$dayDiff.days
$h =$dayDiff.hours
$m =$dayDiff.Minutes
$s = $daydiff.Seconds
$info.Uptime = "$d Days $h Hours $m Min $s Sec"
$Info
#Script 2: Delete-List-Items.ps1
# http://markimarta.com/sharepoint/delete-all-items-in-sharepoint-list-using-powershell/
# there seems to be a problem with running this script in version 3 or later, the workaround is to run it in version 2
# below is the cmd for doing so, just open up a DOS prompt with Admin Privileges Start-->Run-->cmd
# type then copy and paste the following line the DOS window then you can run this script
#powershell.exe -version 2.0
# make sure that the Microsoft.SharePoint.PowerShell Snap-in is installed as well
if ( (Get-PSSnapin -Name Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue) -eq $null )
Add-PsSnapin Microsoft.SharePoint.PowerShell
# "Enter the site URL instead http://serverurl"
$SITEURL = "%http://serverurl%"
$site = new-object Microsoft.SharePoint.SPSite ( $SITEURL )
$web = $site.OpenWeb()
"Web is : " + $web.Title
# Enter name of the List below in the [“%List-Name%”]
$oList = $web.Lists["%List-Name%"];
# This echo out the name of the list its going to be deleting the records from
"List is :" + $oList.Title + " with item count " + $oList.ItemCount
# It’s just counting the rows/records
$collListItems = $oList.Items;
$count = $collListItems.Count - 1
# Here is where it is actually deleting the records and then out put the number or the record it deleted
for($intIndex = $count; $intIndex -gt -1; $intIndex--)
"Deleting record: " + $intIndex
$collListItems.Delete($intIndex);
#Script 3: Populate-SP_Test.ps1
# http://blogs.technet.com/b/stuffstevesays/archive/2013/07/10/3577320.aspx
# there seems to be a problem with running this script in version 3 or later, the workaround is to run it in veriosn 2
# below is the cmd for doing so, just open up a DOS prompt with Admin Privileges Start-->Run-->cmd
# type then copy and paste the following line the the DOS window then you can run this script
#powershell.exe -version 2.0
# make sure that the Microsoft.SharePoint.PowerShell Snap-in is installed
if ( (Get-PSSnapin -Name Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue) -eq $null )
Add-PsSnapin Microsoft.SharePoint.PowerShell
# Here are some more varables that can be added I was not able to get this to work
#$SPComputerInfo="/Lists/PowershellTest/"
# Here is where we connect and Open SharePoint List via Powershell
$SPServer= "%http://serverurl%
$spWeb = Get-SPWeb $SPServer
$spData = $spWeb.GetList("%List-Name%")
# This is the variable for the path that has the file I want to input to SharePoint List
$InvFile="\\%location-ofList%\computers.csv"
# This is just some error checking to make sure the file exist
$FileExists = (Test-Path $InvFile -PathType Leaf)
if ($FileExists) {
"Loading $InvFile for processing..."
$tblData = import-csv $InvFile
} else {
"$InvFile not found - stopping import!"
exit
# Loop through Applications add each one to SharePoint
"Uploading data to SharePoint...."
foreach ($row in $tblData) {
#Here is where I add the information from my CSV file
#2 things have to be present
# 1. the columns have to be in the sharepoint site before I can import the information
# 2. columns have to the headers in my csv file
#"Adding entry for "+$row."Computer Information".ToString()
$spItem = $spData.AddItem()
$spItem["ServerName"] = $row."ServerName".ToString()
$spItem["Uptime"] = $row."Uptime".ToString()
#$spItem["DNSHostName"] = $row."DNSHostName".ToString()
#$spItem["DistinguishedName"] = $row."DistinguishedName".ToString()
$spItem.Update()
# This is just disconnecting from SharePoint
$spWeb.Dispose()
Enjoy, and if anyone has a better way of doing this I'm interested in knowing, thanks again
Thanks in Adavance -
Powershell Script - Convert Managed Metadata column Value to string
HI,
I have written a small PowerShell Script to pull records from a SP List and put them in a csv file. Here is the script:
$MyWeb = Get-SPWeb "http://dev-apps:8800/applications/PA"
$MyList = $MyWeb.Lists["Alist"]
$exportlist = @()
$Mylist.Items | foreach {
$obj = New-Object PSObject -Property @{
“PName” = $_["Port Name"]
"AName" = $_["Agent Name"]
"Address 1" = $_["Address 1"]
"Address 2" = $_["Address 1"]
"Address 3" = $_["Address 3"]
"Address 4" = $_["Address 4"]
$exportlist += $obj
$exportlist | Export-Csv -path 'C:\Filename.csv'
The script is running all right, the output file is also created, data is also correct for all columns but 1. This PName is a
Managed metadata type column and the output values I am getting for this column are like this:
"ERICA|a6d1e8fd-1f6b-4e09-9830-d21e35950881"
"CLIVE|24dff17f-a1b5-4abe-ae86-57299e1e098b"
viz. the ["Actual Value"|"its GUID"] (seems so). I do not want this GUID to be included in the result csv. Is there a way to remove it.
P.S. Choice column values are being fetched just file.Try this (you'll need to add in your other properties)
$items = New-Object psobject
$items | Add-Member -MemberType NoteProperty -Name "AName" -value "" ;
$items | Add-Member -MemberType NoteProperty -Name "PName" -value "" ;
$items | Add-Member -MemberType NoteProperty -Name "Address1" -value "" ;
$items | Add-Member -MemberType NoteProperty -Name "Address2" -value "" ;
$items | Add-Member -MemberType NoteProperty -Name "Address3" -value "";
$exportlist = @();
$Mylist.Items | foreach {
$pname = $_["PName"] -as [Microsoft.SharePoint.Taxonomy.TaxonomyFieldValue];
$obj = $items | Select-Object *;
$obj.AName = $_["AName"];
$obj.PName = $pname.Label;
$obj.Address1 = $_["Address 1"];
$obj.Address2 = $_["Address 2"];
$obj.Address3 = $_["Address 3"];
$exportlist += $obj
$exportlist | Export-Csv -path 'C:\AData.csv'
Regards, Matthew
MCPD | MCITP
My Blog
View
Matthew Yarlett's profile
See my webpart on the TechNet Gallery that allows administrative users to upload, crop and format user profile photos. Check it out here:
Upload and Crop User Profile Photos -
Hi,
I have 3 KPI's, I want all the KPI's in Column wise. By default it is row wise but for my requirements is. I want to make all KPI's as a coulm.
Can anyone tell me. Its annoying me like anything.
Thanks & Regards
Pomani SankaranHi Ravi
In SD and MM you can do it with BADI or enhancements. Please, see these notes:
Note 1156325 - BAdIs in the Logistics Invoice Verification environment
Note 301077 - User exits for the interface to accounting
For invoices in FI (FB60/FB70 and so on), maybe with the BTE 00001610
I hope this helps you
Regards
Eduardo -
Update a filed value with powershell script with ordery by and where condition
Hi
I have below powershell script to update list columns but how i update a field value with ordery by a column and where condition
below is the part of my script
$list = $web.Lists[$listName]
$items = $list.items
$internal_counter = 1
#Go through all items
foreach($item in $items)
if($item["CourtNO"] -eq $null)
#if($item["CourtNo"] -eq '1')
$item["CaseNo"] = $internal_counter
#how to add a column ordery by Title
# and where Title field value from 1 to 10
$internal_counter++
adilHi,
You mean that you only need to update all items with Title field value in range 1..10 and order by them before run the loop statement update?
If so, use CAML query to get the items only match the condition.
#Build Query
$spQuery = New-Object Microsoft.SharePoint.SPQuery
$query = '<Where><And><Gte><FieldRef Name="Title" /><Value Type="Text">0</Value></Gte><Lte><FieldRef Name="Title" /><Value Type="Text">10</Value></Lte></And></Where><OrderBy><FieldRef
Name="Title"/></OrderBy>'
$spQuery.Query = $query
$spQuery.RowLimit = $list.ItemCount
$items = $list.GetItems($spQuery)
Hope this help!
/Hai
Visit my blog: My Blog | Visit my forum:
SharePoint Community for Vietnamese |
Bamboo Solution Corporation -
Display spool output i.e a single row in a single line
hello All,
I have report that outputs many columns is single row , when run in the background.
The problem that I am facing that the the single row of columns is wrapped into second line when certain limit of chararcters is reached. That is the single row of data is placed into two lines.
While running the job in the background I choose the LOCL or LP01 printer with format X_65_255.
Also note that I have other SAP systems but in that systems when I use the same procedure(printer and format also the same) for the same report the outputf for single row is not warpped into 2 lines but appears in the same line.
Please provide your input. Points will be rewrded for helpful answers
regards
SachinNote that this solution is for downloading wide formats only - not printing...
Here is what I did:
To create format Y_1024_1023 (New name!)
1) Transaction SPAD
2) Click "Full Administration" button
3) Click on "Device Types" tab
4) Click "Display" button next to "Format Types" field
5) Place cursor on X_65_255
6) Click in menu Format --> Create using template (F5)
7) Change Number of rows to 1023 (if set to 65, you will have more pages and hence more headers)
9) Change Number of Columns to 1023 (as wide as can be displayed in SP01)
8)Give new name to format e.g. Y_1023_1023
To create spool device YSPOOL:
1) Transaction SPAD
2) Click on "Device/Servers" tab (first tab!)
3) Click 'Display" button next to Output Devices field
4) Click "Create" button (Shift-F1)
5) Give output device long name (e.g.YSPOOL) and short name (e.g.YSPO)
6) Device attributes tab --> Device type = ASCIIPRI (Some generic ASCII printer) - I actually used a ZU_ASCII created in our system but ASCIIPRI should also work.
7) Access method tab --> Host printer = some value (e.g. outfile2)
8) Save
Now assign Y_1024_1023 to Device type:
1) Transaction SPAD
2) Click on Device types tab
3) Enter "ASCIIPRI" in "Device types" field and click display button
4) Click on "Formats" button (F6)
5) Click on "Create' button (Shift-F1)
6) In popup, type Y_1023_1023 (or use drop-down to choose from)
7) Save
Per OSS Note 186603 --> Call SPAD and choose Settings -> Spool System -> Other. Select 'SP01: Number of Lines for List Display from Format'. You may have to clear cache via SPAD->Goto->Cache control -->Click "Reset Cache Settings".
Now, when you schedule your background job, choose YSPOOL as your output device and choose the format as Y_1024_1023. The spool generated from this job will be 1023 columns wide and 1024 lines long (less headers!). Note that opening such a large spool (long & wide) will consume lots of app server memory so exit out as soon as download to presentation server is complete. -
Iterate columns rather than rows?
Hi All
Apologies for what is probably a painfully stupid question, as an almost complete newbie I'm not familar with the intricaies of the SDK but ...
I am building a plugin (primarily for Premiere users) which I think would lend itself better to iteration over columns rather than rows. Is there any built in iterate function that handles this situation, or would this be a situation where coding my own iteration loop could be better?
I ask because I have succesfully built my plugin in AE (using the Shifter example as a basis) and it works but the performance is not great. I've built the same plugin using the Premiere SDK (coding my own iteration loop) and the performance is much better.
Appreciate any idiot friendly tips.
Cheers
Andyhi Andy! welcome to the forum!
your question is not at all stupid!
there is no API function that would directly iterate over columns instead
of rows.
you'll have to write you own function for that, which is in many ways
better that using a suite, because of the minimal overhead in custom
functions.
you can use "iterate_generic()" to make you code multi-threaded on a column
by column basis. -
Get the daily incremental search crawl information using PowerShell script
Dear Friends ,
I want to get the daily incremental search crawl information using PowerShell script . I need this information into CSV or txt format . Can you please help me with this.
valmikiHi
I have got the below script which worked .
## SharePoint Reference
[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Administration")
[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.Office.Server.Search.Administration")
[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.Office.Server.Search")
[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.Office.Server")
function global:Get-CrawlHistory($url)
trap [Exception] {
write-error $("ERROR: " + $_.Exception.GetType().FullName);
write-error $("ERROR: " + $_.Exception.Message);
continue;
$s =
new-Object Microsoft.SharePoint.SPSite($url);
$c = [Microsoft.Office.Server.Search.Administration.SearchContext]::GetContext($s);
$h =
new-Object Microsoft.Office.Server.Search.Administration.CrawlHistory($c);
Write-OutPut $h.GetCrawlHistory();
$s.Dispose();
Get-CrawlHistory
-url http://your_site_url/
|
Export-CsvF:\temp\search.csv
valmiki -
How to Parse this XML File and require below mentioned value as output using powershell script
Need values for below as an output for below xml file so help me with the script:
Under Criteria Tag-
TimeStamp Display Value
OID corresponding to display value for nodes "Criterion"
Under Report Body Tag--
name in Report Section and OID value
<?xml version="1.0" encoding="UTF-8"?>
<ReportOutput>
<ReportHead>
<Report name="Execution Action" type="detailedchanges_rpt">
<Description></Description>
</Report>
<Criteria>
<TimestampCriterion name="date" displayvalue="08/10/14 23:08">
<Timestamp displayvalue="08/10/14 23:08">1412780929000</Timestamp>
</TimestampCriterion>
<MatchCriterion name="approvalId" displayvalue="Not applied" operator="contains" />
<MatchCriterion name="promotionComment" displayvalue="Not applied" operator="contains" />
<SelectCriterion name="changeWindow" displayvalue="Not applied" />
<SelectCriterion name="auditEvents" displayvalue="(Any)">
<String>auditEventAny</String>
</SelectCriterion>
<SelectCriterion name="attributeDisplay" displayvalue="Changed attributes">
<String>changed</String>
</SelectCriterion>
<SelectCriterion name="versionCompare" displayvalue="Version with current baseline">
<String>disabled</String>
</SelectCriterion>
<BooleanCriterion name="showContentDiff" displayvalue="No">
<Boolean value="false" />
</BooleanCriterion>
<BooleanCriterion name="displayUsers" displayvalue="No">
<Boolean value="false" />
</BooleanCriterion>
<BooleanCriterion name="displayPackages" displayvalue="No">
<Boolean value="false" />
</BooleanCriterion>
<BooleanCriterion name="displayCustomProperties" displayvalue="No">
<Boolean value="false" />
</BooleanCriterion>
<BooleanCriterion name="strictPackageMatch" displayvalue="No">
<Boolean value="false" />
</BooleanCriterion>
<BooleanCriterion name="displayCriteriaAtEnd" displayvalue="No">
<Boolean value="false" />
</BooleanCriterion>
<SelectCriterion name="elementExists" displayvalue="Not applied" />
<IntegerCriterion name="maxLinesPerBlock" displayvalue="10">
<Integer>10</Integer>
</IntegerCriterion>
<NodesCriterion name="nodes" displayvalue="TripwireENT.demo.net">
<OID>-1y2p0ij32e8bw:-1y2p0ij32e7cu</OID>
</NodesCriterion>
<MatchCriterion name="nodeName" displayvalue="Not applied" operator="contains" />
<CustomPropertiesCriterion name="nodeProps" displayvalue="Not applied" />
<RulesCriterion name="rules" displayvalue="Critical System Files">
<OID>-1y2p0ij32e7q2:-1y2p0ij31snh6</OID>
</RulesCriterion>
<MatchCriterion name="ruleName" displayvalue="Not applied" operator="contains" />
<MatchCriterion name="elementName" displayvalue="Not applied" operator="contains" />
<CustomPropertiesCriterion name="elementProps" displayvalue="Not applied" />
<CustomPropertiesCriterion name="versionProps" displayvalue="Not applied" />
<AttributesCriterion name="attributes" displayvalue="Not applied">
<Integer name=".missingImpliesFailure">1</Integer>
</AttributesCriterion>
<ContentCriterion name="content" displayvalue="Not applied" />
<MatchCriterion name="auditEventUserName" displayvalue="Not applied" operator="contains" />
<IntegerCriterion name="changeType" displayvalue="Added, Modified, Removed">
<Integer>7</Integer>
</IntegerCriterion>
<SeverityRangeCriterion name="severity" displayvalue="1 - 10000">
<Integer name="min">1</Integer>
<Integer name="max">10000</Integer>
</SeverityRangeCriterion>
<BooleanCriterion name="currentVersionsOnly" displayvalue="Yes">
<Boolean value="true" />
</BooleanCriterion>
<TimeRangeCriterion name="timeRange" displayvalue="All time" />
<PackagesCriterion name="packages" displayvalue="Not applied" />
<SortCriterion name="sortNodes" displayvalue="Name, ascending" isascending="true">
<String>name</String>
</SortCriterion>
<SortCriterion name="sortRules" displayvalue="Name, ascending" isascending="true">
<String>name</String>
</SortCriterion>
<SortCriterion name="sortElements" displayvalue="Name, ascending" isascending="true">
<String>name</String>
</SortCriterion>
<SortCriterion name="sortVersions" displayvalue="Date, descending" isascending="false">
<String>date</String>
</SortCriterion>
</Criteria>
</ReportHead>
<ReportBody>
<ReportSection name="TripwireENT.demo.net" category="node">
<OID>-1y2p0ij32e8bw:-1y2p0ij32e7cu</OID>
<String name="typeName">Windows Server</String>
<ReportSection name="Critical System Files" category="rule">
<OID>-1y2p0ij32e7q2:-1y2p0ij31snh6</OID>
<String name="typeName">Windows File System Rule</String>
<ReportSection name="C:\Temp" category="element">
<OID>-1y2p0ij32e8dr:-1y2p0ij32e586</OID>
<ReportSection name="08/10/14 22:48" category="version">
<OID>-1y2p0ij32e8du:-1y2p0ij32e3ho</OID>
<Integer name="changeType">1</Integer>
<String name="changeTypeName">Added</String>
<Integer name="severity">10000</Integer>
<String name="severityName">High</String>
<Timestamp name="changeTime" displayvalue="08/10/14 22:48">1412779682000</Timestamp>
<String name="approvalId"></String>
<ReportSection name="attributes" category="attributes">
<ReportSection name="DACL" category="added">
<String name="observed">Inherits Entries: true
NT AUTHORITY\SYSTEM, Access Allowed:
Standard rights:
Full Control
Modify
Read & Execute
List Folder Contents
Read
Write
Delete
Read Control
Write DAC
Write Owner
Synchronize
Specific rights:
Full Control
Traverse Folder / Execute File
List Folder / Read Data
Read Attributes
Read Extended Attributes
Create Files / Write Data
Create Folders / Append Data
Write Attributes
Write Extended Attributes
Directory Delete Child
Read Permissions
Change Permissions
Take Ownership
Header flags:
Object Inherit
Container Inherit
Inherited
BUILTIN\Administrators, Access Allowed:
Standard rights:
Full Control
Modify
Read & Execute
List Folder Contents
Read
Write
Delete
Read Control
Write DAC
Write Owner
Synchronize
Specific rights:
Full Control
Traverse Folder / Execute File
List Folder / Read Data
Read Attributes
Read Extended Attributes
Create Files / Write Data
Create Folders / Append Data
Write Attributes
Write Extended Attributes
Directory Delete Child
Read Permissions
Change Permissions
Take Ownership
Header flags:
Object Inherit
Container Inherit
Inherited
BUILTIN\Users, Access Allowed:
Standard rights:
Read & Execute
List Folder Contents
Read
Read Control
Synchronize
Specific rights:
Traverse Folder / Execute File
List Folder / Read Data
Read Attributes
Read Extended Attributes
Read Permissions
Header flags:
Object Inherit
Container Inherit
Inherited
BUILTIN\Users, Access Allowed:
Specific rights:
Create Folders / Append Data
Header flags:
Container Inherit
Inherited
BUILTIN\Users, Access Allowed:
Specific rights:
Create Files / Write Data
Header flags:
Container Inherit
Inherited
CREATOR OWNER, Access Allowed:
Generic rights:
Generic All
Specific rights:
Full Control
Traverse Folder / Execute File
List Folder / Read Data
Read Attributes
Read Extended Attributes
Create Files / Write Data
Create Folders / Append Data
Write Attributes
Write Extended Attributes
Directory Delete Child
Read Permissions
Change Permissions
Take Ownership
Header flags:
Object Inherit
Container Inherit
Inherit Only
Inherited
</String>
</ReportSection>
<ReportSection name="Group" category="added">
<String name="observed">TRIPWIREENT\None</String>
</ReportSection>
<ReportSection name="Owner" category="added">
<String name="observed">BUILTIN\Administrators</String>
</ReportSection>
<ReportSection name="Read-Only" category="added">
<String name="observed">false</String>
</ReportSection>
<ReportSection name="SACL" category="added">
<String name="observed">(null)</String>
</ReportSection>
<ReportSection name="Type" category="added">
<String name="observed">Directory</String>
</ReportSection>
</ReportSection>
</ReportSection>
</ReportSection>
<ReportSection name="C:\Windows\System32\drivers\etc\hosts" category="element">
<OID>-1y2p0ij32e8dr:-1y2p0ij32e4kp</OID>
<ReportSection name="08/10/14 23:08" category="version">
<OID>-1y2p0ij32e8du:-1y2p0ij32e3hk</OID>
<Integer name="changeType">2</Integer>
<String name="changeTypeName">Modified</String>
<Integer name="severity">10000</Integer>
<String name="severityName">High</String>
<Timestamp name="changeTime" displayvalue="08/10/14 23:08">1412780929000</Timestamp>
<String name="approvalId"></String>
<ReportSection name="attributes" category="attributes">
<ReportSection name="SHA-1" category="modified">
<String name="expected">de375d8a456a7345323babee88975ca567a2d5c4</String>
<String name="observed">3c5520382f91cb1cd898fee2da4eba3fa338d982</String>
</ReportSection>
<ReportSection name="Size" category="modified">
<String name="expected">829</String>
<String name="observed">854</String>
</ReportSection>
</ReportSection>
</ReportSection>
</ReportSection>
</ReportSection>
</ReportSection>
<ReportSection name="reportTotals" category="reportTotals">
<Integer name="summary.nodeCount">1</Integer>
<Integer name="summary.ruleCount">1</Integer>
<Integer name="summary.elementCount">2</Integer>
</ReportSection>
</ReportBody>
</ReportOutput>Hi Ritehere,
I know this is simple but am beginner in Powershell Script so I was looking for logic to go through however the output you provided is not what i am looking for and your script is too complicated, as under timestamp i wanted display value and correspoding
to display value the OID name and then name value correspoding to that OID. May be u got it wrong.
Thanks anyways. -
Please Vote if you find this to be helpful!
App-V PowerShell: Script to Query XenApp Servers for App-V Publishing Errors and Output an Excel Document with the Results
Just posted this to the wiki:
http://social.technet.microsoft.com/wiki/contents/articles/25323.app-v-powershell-script-to-query-xenapp-servers-for-app-v-publishing-errors-and-output-an-excel-document-with-the-results.aspxHi petro_jemes,
Just a little claritification, you need to add the value to the variable "[string]$ou", and also change the language in the variable "$emailbody" in the function "Get-ADUserPasswordExpirationDate".
I hope this helps. -
Powershell script to change the a column value of all documents in a site.
Hi,
I need a powershell script to change the value of a column (a site column which has been added to all document libraries) in all documents in a site,
For example:
-column 1 is a site column added to all libraries
the value of column 1 of all documents under this site: http://intranet.doman/ex1 should be equal to V1
the value of column 1 of all documents under this site: http://intranet.doman/ex2 should be equal to V2
So, if I can write a powershell script to change the value of all documents in a site, I can modify it for different site that I have and run it for each of them individually,cls
# Is dev version?
$dev = $false
# Configuration
$termStore = "Managed Metadata Service"
$group = "G1"
$subjectMatterTermSetName = "Subject Matter"
# Check if SharePoint Snapin is loaded
if((Get-PSSnapin | Where {$_.Name -eq "Microsoft.SharePoint.PowerShell"}) -eq $null) {
Add-PSSnapin Microsoft.SharePoint.PowerShell
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Taxonomy") | Out-Null
function GetTermStore($site, $termStore, $group, $termSet) {
$session = New-Object Microsoft.SharePoint.Taxonomy.TaxonomySession($site)
$termStore = $session.TermStores[$termStore]
$group = $termStore.Groups[$group]
$termSet = $group.TermSets[$termSet]
return $termSet
if($dev) {
Write-Host "Running DEV version..."
$webUrl = "http://Site1"
$libraryName = "L1"
$subjectMatter = "C1"
} else {
$webUrl = Read-Host "Enter Site URL"
$libraryName = Read-Host "Enter Document Library name"
$subjectMatter = Read-Host "Enter Subject Matter"
try {
$web = Get-SPWeb $webUrl
$site = $web.Site
$library = $web.Lists[$libraryName]
$items = $library.GetItems()
$subjectMatterTermSet = GetTermStore $site $termStore $group $subjectMatterTermSetName
$subjectMatterTerm = $subjectMatterTermSet.GetTerms($subjectMatter,$true) | select -First 1
foreach($item in $items) {
if([string]::IsNullOrEmpty($item["Subject Matter"])) {
#Write-Host "Filename: $filename / Keywords: $keywords / Subject Matter: $subjectMatter / Document Type: $documentType"
Write-Host "Updating $($item["ows_FileLeafRef"])..."
# Set Subject Matter column
$subjectMatterField = [Microsoft.SharePoint.Taxonomy.TaxonomyField]$item.Fields["Subject Matter"]
$subjectMatterField.SetFieldValue($item,$subjectMatterTerm)
# Update Item
$item.SystemUpdate()
catch
$ErrorMessage = $_.Exception.Message
Write-Host "Something went wrong. Error: $ErrorMessage" -ForegroundColor Red -
Powershell - input information in script that is sent to a list in Sharepoint
I got this question from a co-worker of mine. Today we sit on a wss 3.0 installation which acts as a management portal.
Here we have an event log list, where we post events/changes. He is regulary using powershell, and would like to sit here and create the log events, filling out stuff like title, description. The rest of the information whatever that may be, like person
filling out the log, date, tag the item as an event should be autofilled, and then sent to a SharePoint Foundation 2013 list.
Is this possible? I was thinking that the best solution for him, would then be to have some kind of PowerShell GUI?? When he then press save/send, it is automatically sent to the correct list in SharePoint.Hi,
You can create a windows application that will execute your powershell script. Below link might help:
http://blogs.msdn.com/b/kebab/archive/2014/04/28/executing-powershell-scripts-from-c.aspx
Best Regards,
Brij K -
Can I get a query to get the output data like 4th column instead of 3rd col
Can I get a query to get the output data like 4th column instead of 3rd column ?
SQL> select emp.deptno, empno, rownum from emp, dept where emp.deptno=dept.deptno;
DEPTNO EMPNO ROWNUM
10 7782 *1* *1*
10 7839 *2* *2*
10 7934 *3* *3*
20 7369 *4* *1*
20 7876 *5* *2*
20 7902 *6* *3*
20 7788 *7* *4*
20 7566 *8* *5*
30 7499 *9* *1*
30 7698 *10* *2*
30 7654 *11* *3*
30 7900 *12* *4*
30 7844 *13* *5*
30 7521 *14* *6*
14 rows selected.SQL> select emp.deptno, emp.empno,
2 row_number() over(order by emp.deptno, emp.empno) rn,
3 row_number() over(partition by emp.deptno order by emp.empno) dept_rn
4 from emp, dept
5 where emp.deptno=dept.deptno
6 order by emp.deptno, emp.empno;
DEPTNO EMPNO RN DEPT_RN
10 7782 1 1
10 7839 2 2
10 7934 3 3
20 7369 4 1
20 7566 5 2
20 7788 6 3
20 7876 7 4
20 7902 8 5
30 7499 9 1
30 7521 10 2
30 7654 11 3
30 7698 12 4
30 7844 13 5
30 7900 14 6
14 rows selected.Regards,
Dima -
Is it possible to catch a PowerShell script output when an exit code is setted?
Hi,
i'm using TEO 2.1.2 with the hotfixes from 1 to 12 already installed and i have a problem using the "Execute Windows PowerShell Script" in reading the output of a PowerShell script if an exit code is expressly setted . For example if i try to execute a script like:
the output given by the activity is only 0 (like the exit code).
This is a problem if i use a script with multiple exit codes corrisponding to different kind of situations and different outputs like the following:
if($flag -eq "0")
Write-output "Hello"
exit 0
elseif ($flag -eq "1")
Write-output "Error 1"
exit 1
else
Write-output "Error 2"
exit 2
or if i call an executable which exit codes i want to identify by a readable description.
Anyone knows a way to solve this issue?
Thanks a lot,
bye.
GiulioThanks Shaun,
i was already looking toward this kind of approch, but i was also curious if there was a different way of doing this.
Anyway just a little annotation about your line of code, in Tidal 2.1.2 at least, Write-host doesn't work right, echo or Write-Output are fine but Write-host seems to be ignored. To the following script:
the output is
Maybe i'm missing something. Regarding an upgrade, as a devoloper i'd really like to try the improvement of the new version but this is not a decision I can make.
Thank you,
bye.
Giulio
Maybe you are looking for
-
How do I make PDFs OPEN and fit my screen?
Every time I open a PDF, the document opens larger than my screen. How do I make the document fit the screen I have? This is absolutely NOT a zoom problem. I have a 15 inch laptop. It has a screen that is about 12 inches wide x 7.5 inches high. I ope
-
Small input program (html) using sockets.
I'm having problems with the following whenever a cd is inputted via cdinput.html it runs cdprocess.jsp to create an XML document with DOM in memory this is sent to the server and is later printed out to the users screen. The server must be started i
-
Using a different WIFI Internet Connection from Home
I have an Apple Mac Pro at home with a WIFI connection, which works very well. When I took the machine to my father in law who also has a WIFI connection (but from a different company), I tried to connect my lap top to his server box without success.
-
Special G/L indicator X is not defined for down payments (Message no. F505)
{{{ Special G/L indicator X is not defined for down payments Message no. F5053 The specified special G/L indicator is not classified as "down payment" or not listed in the list of the target special G/L indicators for indicator "F".}}} *I have Create
-
Configuring Active Directory with 11g and Windows Server 2003 R2
Hi people, I'm spending some happy hours to setting up the windows domain authentication in a 2003 sever realm. When I try to register the database in the realm (logged as total-administrator-user of domain), NETCA give me an unexpected "no message"