View Single Post
Old 09-28-2007   #4 (permalink)
hectoritnt


 
 

Re: end of line while processing a string token issue

On Sep 28, 12:17 pm, "Brandon Shell" <tshell.m...@xxxxxx> wrote:
Quote:

> As a note... If you decide to stick with the cleanup option... there is much
> better way IMO
>
> function Clean-Vars{
> Param($Filter)
> get-ChildItem variable: | Where-Object{$_.Name -match $filter} |
> remove-Variable -whatif
>
> }
>
> The filter in this case would be "^v\d" I would recommend using a variable
> naming scheme that is more precise
> like myTmpVarX then the filter would be "^myTmpVar\d"
>
> "hectoritnt" <hectori...@xxxxxx> wrote in message
>
> news:1190993581.745539.310020@xxxxxx
>
Quote:

> >I have this piece of code and can't figure out why it gives me this
> > error every time.
>
Quote:

> > PS C:\Tools\Scripts> .\getusers.ps1
> > Encountered end of line while processing a string token.
> > At C:\Tools\Scripts\getusers.ps1:108 char:30
> > + + $v30 + "," + $v31 + "," <<<< + $v32
>
Quote:

> > Code;
>
Quote:

> > $tempfile = "c:\temp.txt"
>
Quote:

> > function Clean-Vars
> > { $v1 = ""; $v2 = ""; $v3 = ""; $v4 = ""; $v5 = ""; $v6 = ""; $v7 =
> > ""; $v8 = ""; $v9 = ""; $v10 = ""; $v11 = "";
> > $v12 = ""; $v13 = ""; $v14 = ""; $v15 = ""; $v16 = ""; $v17 = "";
> > $v18 = ""; $v19 = ""; $v20 = ""; $v21 = "";
> > $v22 = ""; $v23 = ""; $v24 = ""; $v25 = ""; $v26 = ""; $v27 = "";
> > $v28 = ""; $v29 = ""; $v30 = ""; $v31 = "";
> > $v32 = "" }
>
Quote:

> > $allusers = get-adobject -domain mcd.pri -pagesize 500 -filter
> > "(&(mailNickname=*)(objectclass=user))
> > Clean-Vars
> > foreach ($one in $allusers) {
> > $usrs = $usrs + 1
> > $v1 = $one.objectclass[1]
> > $v2 = $one.cn
> > $v3 = $one.msExchHomeServerName.tostring()
> > $v3 = $v3.split('=')[5]
> > $v4 = $one.MDBOverquotalimit
> > $v5 = $one.mDBUseDefaults
> > $v6 = $one.mDBOverHardQuotaLimit
> > $v7 = $one.mailnickname
> > $v8 = $one.whencreated.tostring()
> > $v9 = $one.whenchanged.tostring()
> > $v10 = $one.sAMAccountName
> > $v11 = $one.givenname
> > $v12 = $one.sn
> > $v13 = '"' + $one.displayname + '"'
> > $v14 = $one.userprincipalname
> > $v15 = $one.mail
> > $v16 = $one.proxyaddresses
> > $v17 = $one.ou
> > $v18 = $one.msexchhidefromaddresslists
> > $v19 = $one.altrecipient
> > $v20 = $one.extensionattribute1
> > $v21 = $one.deliverandredirect
> > $v22 = $one.admindescription
> > $v24 = $one.telephoneNumber
> > $v25 = $one.pager
> > $v29 = '"' + $one.memberof + '"'
> > $v30 = $one.department
> > $v31 = $one.tittle
> > #
> > $vtot = $v1 + "," + $v2 + "," + $v3 + "," + $v4 + "," + $v5 + ","
> > + $v6 + "," + $v7 + "," + $v8 + "," + $v9 + "," + $v10 + "," + $v11 +
> > "," `
> > + $v12 + "," + $v13 + "," + $v14 + "," + $v15 + "," + $v16 + ","
> > + $v17 + "," + $v18 + "," + $v19 + "," + $v20 + "," `
> > + $v21 + "," + $v22 + "," + $v23 + "," + $v24 + "," + $v25 + ","
> > + $v26 + "," + $v27 + "," + $v28 + "," + $v29 + "," `
> > + $v30 + "," + $v31 + "," + $v32
> > add-content $tempfile $vtot
> > $vtot = ""
> > Clean-Vars
> > }
>
Quote:

> > Any help will be appreciated.
>
Quote:

> > Hector
I have to recreate the format of the old GAL dump from the Exchange
5.5 days because it's being used as input for some external
processes. I'm cleaning the variables to make sure I don't carry
unwanted data. It is not meant to be part of the final product.

My System SpecsSystem Spec