Sign in to follow this  
Followers 0
Ruigerock

If @computername contains the characters Then..

6 posts in this topic

#1 ·  Posted (edited)

Since a week ago i've added some autoit functions into the company's loginscript and i want to tweak it a little bit more.

We use Windows Defender in our company and not all the computers have this installed.

So i wrote this code to see which computers are missing Windows Defender.

If Not FileExists (@ProgramFilesDir & "\Windows Defender\MSASCui.exe") Then
$file = FileOpen("\\server01\log$\Windows Defender log.txt", 1)
FileWriteLine($file, @MDAY & "-" & @MON & "-" & @YEAR & " " & @HOUR & ":" & @MIN & " op " & @ComputerName & " is geen Windows Defender geconstateerd, username gebruikt bij opstarten is " & @UserName)
FileClose($file)
EndIfoÝ÷ Ø(®K)z·ÞrÙrnëZZ.®Ç«½êìv÷öØZ½å¢Ú0°7zw^®)쵩eyÔ¨%¢Ú0°7zw^®Z ·b±ø¥)àº"¶®÷«©±©Ý§ßÛm¡«èÛaÀn¶'m~(.­ê.¶0¶hÑh­ìZ^f wZ.®Ç«½êìj·§jg±êïz½5±êïz½6±êïz½7z×Á©í¶uªîëajض¢jnµêçjg¢{Z{-ì(­Û®÷«¶§²H©¶W®+^.)Þjëh×6If Not @computername = "server??" Then FileWriteLine etc.. etc..
doesn't work.

Anyone ideas?

Edited by Ruigerock

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

Dim $CompName = @Computername
If StringInStr($CompName, "Server")  Then
 ;Skip file write
Else
 ;FileWriteLine()
EndIf oÝ÷ Ûú®¢×©ä³(}HßÛÞ,^v+n¦Ú zØ^¯­Ø^~*춫µ«­¢+Ù¥´ÀÌØí
½µÁ9µô
½µÁÕÑɹµ)%9½Ð¥±á¥ÍÑÌ¡Aɽɵ¥±Í¥ÈµÀìÅÕ½ÐìÀäÈí]¥¹½Ý̹ÈÀäÈí5MM
Õ¤¹áÅÕ½Ðì¤Q¡¸(%9½ÐMÑÉ¥¹%¹MÑÈ ÀÌØí
½µÁ9µ°ÅÕ½ÐíMÉÙÈÅÕ½Ðì¤Q¡¸(ÀÌØí¥±ô¥±=Á¸ ÅÕ½ÐìÀäÈìÀäÈíÍÉÙÈÀÄÀäÈí±½ÀÌØìÀäÈí]¥¹½Ý̹ȱ½¹ÑáÐÅÕ½Ðì°Ä¤(¥±]É¥Ñ1¥¹ ÀÌØí¥±°5dµÀìÅÕ½Ðì´ÅÕ½ÐìµÀì5=8µÀìÅÕ½Ðì´ÅÕ½ÐìµÀìeHµÀìÅÕ½ÐìÅÕ½ÐìµÀì!=UHµÀìÅÕ½ÐìèÅÕ½ÐìµÀì5%8µÀìÅÕ½Ðì½ÀÅÕ½ÐìµÀì
½µÁÕÑÉ9µµÀìÅÕ½Ðì¥Ì¸]¥¹½Ý̹Ƚ¹ÍÑÑÉ°ÕÍɹµÉÕ¥­Ð¥¨½ÁÍÑÉѸ¥ÌÅÕ½ÐìµÀìUÍÉ9µ¤(¥±
±½Í ÀÌØí¥±¤(¹%)¹%

Works great!

Edited by Ruigerock

Share this post


Link to post
Share on other sites

Hmm i faced another problem :whistle:

If Not StringInStr($CompName, "Server")
If Not StringInStr($CompName, "Server") OR Not StringInStr($CompName, "Fax") OR Not StringInStr($CompName, "Mail")

Maybe ?


My little company: Evotec (PL version: Evotec)

Share this post


Link to post
Share on other sites

If Not StringInStr($CompName, "Server") OR Not StringInStr($CompName, "Fax") OR Not StringInStr($CompName, "Mail")

Maybe ?

He Madboy,

I've tried your code but it didn't work, "fax" still made a FileWriteLine

So i kept trying different combinations and eventually when i used "AND" in stead of "OR" it started working.

Thanks all..

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0