Jump to content

Recommended Posts

Posted

Hi All! :whistle:

I've got a little script which changes my local admin PW.

It works fine with 3.0.94 but now - after working under 3.0.100 i didn't get my log-file.

Here is my code which works under 3.0.94 :

$reg = 0
$akt = 4
$vname = EnvGet("COMPUTERNAME")
$vday = @MDAY & "-" & @MON & "-" & @YEAR

$reg = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\ADPW", "Version")

If $reg < $akt Then
   $val = RunWait(@comspec & ' /C net user administrator goodpw /expires:NEVER /passwordchg:YES', "", @SW_HIDE)
 
   If $val = 0 Then
      RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\ADPW", "Version", "REG_SZ", $akt)
      RunWait(@comspec & ' /C net use t: /d', "", @SW_HIDE)
      $vnet = RunWait(@comspec & ' /C net use t: \\server01\myshare$', "", @SW_HIDE)
      If $vnet = 0 Then
  $file = FileOpen("t:\Log\" & $vname & ".txt", 1)
  FileWriteLine($file, "Letzte Aenderung am : " & $vday & " auf Version : " & $akt & @LF)
  FileClose($file)
         RunWait(@comspec & ' /C net use t: /d', "", @SW_HIDE)
      EndIf
   EndIf
EndIf

So - can anybody help me to fix my problem?

I mean following lines :

RunWait(@comspec & ' /C net use t: /d', "", @SW_HIDE)
$vnet = RunWait(@comspec & ' /C net use t: \\server01\myshare$', "", @SW_HIDE)
$file = FileOpen("t:\Log\" & $vname & ".txt", 1)
  FileWriteLine($file, "Letzte Aenderung am : " & $vday & " auf Version : " & $akt & @LF)
FileClose($file)
RunWait(@comspec & ' /C net use t: /d', "", @SW_HIDE)

:iamstupid:

Thx

  • Administrators
Posted

In the FileWriteLine command remove the @LF at the end (Or, if you prefer change it to @CRLF)


 

Posted

Hi Jon,

thanks, but this is not my problem.

It seems that following code didn't work naymore under x.100

RunWait(@comspec & ' /C net use t: /d', "", @SW_HIDE)

I get an file open error .. :whistle:

An ideas?

Posted

Upps - sorry :whistle:

Wrong line ...

I mean this lines :

$vnet = RunWait(@comspec & ' /C net use t: \\server01\myshare$', "", @SW_HIDE)
      If $vnet = 0 Then
  $file = FileOpen("t:\Log\" & $vname & ".txt", 1)

Here i get an file open error ..

Posted

B) shoudn'd change to much :angry::evil:

There was a missing space or a wrong sign ... :whistle:

I step back to a working version a changed this script up to the final version and - who wonders - it works :lmao:

Sorry and thanks for your help

Its a super scripting tool!

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...